aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2015-08-08 18:01:21 -0400
committerJason Merrill <jason@gcc.gnu.org>2015-08-08 18:01:21 -0400
commitd6729a4291a69749ea7faf55bba2c4520ca6a6a9 (patch)
treeeb12bedf19b9d82697a38e97c545461fa97aacc0 /gcc
parenta2dfb563745d1b0be669f49e37f6b7d56ee65991 (diff)
downloadgcc-d6729a4291a69749ea7faf55bba2c4520ca6a6a9.zip
gcc-d6729a4291a69749ea7faf55bba2c4520ca6a6a9.tar.gz
gcc-d6729a4291a69749ea7faf55bba2c4520ca6a6a9.tar.bz2
re PR c++/67142 ([C++1z] ICE: tree check: expected template_decl, have field_decl in equal, at cp/pt.c:1665)
PR c++/67142 * pt.c (equal): Make sure tmpl is actually a template. From-SVN: r226737
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog3
-rw-r--r--gcc/cp/pt.c2
-rw-r--r--gcc/testsuite/g++.dg/cpp1z/regress2.C17
3 files changed, 22 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 40ed123..3239239 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,8 @@
2015-08-08 Jason Merrill <jason@redhat.com>
+ PR c++/67142
+ * pt.c (equal): Make sure tmpl is actually a template.
+
PR c++/67114
* call.c (joust): Only call more_constrained on decls.
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 1b64174..e05d775 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -1662,6 +1662,8 @@ spec_hasher::equal (spec_entry *e1, spec_entry *e2)
equal = (e1->tmpl == e2->tmpl
&& comp_template_args (e1->args, e2->args));
if (equal && flag_concepts
+ /* tmpl could be a FIELD_DECL for a capture pack. */
+ && TREE_CODE (e1->tmpl) == TEMPLATE_DECL
&& VAR_P (DECL_TEMPLATE_RESULT (e1->tmpl))
&& uses_template_parms (e1->args))
{
diff --git a/gcc/testsuite/g++.dg/cpp1z/regress2.C b/gcc/testsuite/g++.dg/cpp1z/regress2.C
new file mode 100644
index 0000000..d9bf0da
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1z/regress2.C
@@ -0,0 +1,17 @@
+// PR c++/67142
+// { dg-options -std=c++1z }
+
+namespace detail {
+template <int> int split_at;
+}
+struct A {
+ decltype(0) operator()();
+};
+template <typename> A make;
+struct Tuple;
+auto check =
+ [](auto, auto, auto) { [](auto... xs) { [=] { make<Tuple>(xs...); }; }(); };
+int main() {
+ namespace vd = detail;
+ check(vd::split_at<0>, make<Tuple>, make<Tuple>);
+}