aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2015-08-08 18:01:29 -0400
committerJason Merrill <jason@gcc.gnu.org>2015-08-08 18:01:29 -0400
commit4e7739b25ab46d9c573222680ad2862d263c909e (patch)
treee2c799f9127cd9e5418f54ff0ee0649b9040aae8 /gcc
parentd6729a4291a69749ea7faf55bba2c4520ca6a6a9 (diff)
downloadgcc-4e7739b25ab46d9c573222680ad2862d263c909e.zip
gcc-4e7739b25ab46d9c573222680ad2862d263c909e.tar.gz
gcc-4e7739b25ab46d9c573222680ad2862d263c909e.tar.bz2
re PR c++/67159 ([c++concepts] Segfault while diagnosing constraint violation)
PR c++/67159 * constraint.cc (finish_template_introduction): SET_NON_DEFAULT_TEMPLATE_ARGS_COUNT. From-SVN: r226738
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog4
-rw-r--r--gcc/cp/constraint.cc1
-rw-r--r--gcc/testsuite/g++.dg/concepts/diagnostic1.C16
3 files changed, 21 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 3239239..f04b15c 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,9 @@
2015-08-08 Jason Merrill <jason@redhat.com>
+ PR c++/67159
+ * constraint.cc (finish_template_introduction):
+ SET_NON_DEFAULT_TEMPLATE_ARGS_COUNT.
+
PR c++/67142
* pt.c (equal): Make sure tmpl is actually a template.
diff --git a/gcc/cp/constraint.cc b/gcc/cp/constraint.cc
index cf57cc0..c981212 100644
--- a/gcc/cp/constraint.cc
+++ b/gcc/cp/constraint.cc
@@ -1337,6 +1337,7 @@ finish_template_introduction (tree tmpl_decl, tree intro_list)
tree parm = TREE_VEC_ELT (parm_list, n);
TREE_VEC_ELT (check_args, n) = template_parm_to_arg (parm);
}
+ SET_NON_DEFAULT_TEMPLATE_ARGS_COUNT (check_args, n);
/* If the template expects more parameters we should be able
to use the defaults from our deduced concept. */
diff --git a/gcc/testsuite/g++.dg/concepts/diagnostic1.C b/gcc/testsuite/g++.dg/concepts/diagnostic1.C
new file mode 100644
index 0000000..7c360cc
--- /dev/null
+++ b/gcc/testsuite/g++.dg/concepts/diagnostic1.C
@@ -0,0 +1,16 @@
+// PR c++/67159
+// { dg-options -std=c++1z }
+
+template <class T>
+concept bool R = requires (T& t) {
+ { t.begin() } -> T
+};
+
+struct foo {
+ int* begin();
+};
+
+R{T}
+constexpr bool f() { return true; }
+
+static_assert(f<foo>()); // { dg-error "" }