aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2017-03-24 10:40:13 -0400
committerJason Merrill <jason@gcc.gnu.org>2017-03-24 10:40:13 -0400
commit90471a3d8330dff361297f72fa95c157e26ea345 (patch)
treebb40fb80c4ddb65fe7477355925839b462a06956
parentc8b1fbc12a6a7249f93a985c697c8e0edeb2a6d5 (diff)
downloadgcc-90471a3d8330dff361297f72fa95c157e26ea345.zip
gcc-90471a3d8330dff361297f72fa95c157e26ea345.tar.gz
gcc-90471a3d8330dff361297f72fa95c157e26ea345.tar.bz2
PR c++/77339 - ICE with invalid use of alias template.
* pt.c (lookup_template_class_1): Don't try to enter the scope of an alias template. From-SVN: r246462
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/pt.c4
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/alias-decl-58.C7
3 files changed, 15 insertions, 2 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index f8e711b..ea1eaa7 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+2017-03-24 Jason Merrill <jason@redhat.com>
+
+ PR c++/77339 - ICE with invalid use of alias template.
+ * pt.c (lookup_template_class_1): Don't try to enter the scope of an
+ alias template.
+
2017-03-24 Marek Polacek <polacek@redhat.com>
PR c++/80119
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 5259dad..cbe8082 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -8682,9 +8682,9 @@ lookup_template_class_1 (tree d1, tree arglist, tree in_decl, tree context,
|| !PRIMARY_TEMPLATE_P (gen_tmpl)
|| currently_open_class (template_type))
{
- tree tinfo = TYPE_TEMPLATE_INFO_MAYBE_ALIAS (template_type);
+ tree tinfo = TYPE_TEMPLATE_INFO (template_type);
- if (comp_template_args (TI_ARGS (tinfo), arglist))
+ if (tinfo && comp_template_args (TI_ARGS (tinfo), arglist))
return template_type;
}
diff --git a/gcc/testsuite/g++.dg/cpp0x/alias-decl-58.C b/gcc/testsuite/g++.dg/cpp0x/alias-decl-58.C
new file mode 100644
index 0000000..0ae1c49
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/alias-decl-58.C
@@ -0,0 +1,7 @@
+// PR c++/77339
+// { dg-do compile { target c++11 } }
+
+template < typename > using A = int;
+
+//OK: template < typename X > A < X > a;
+template < typename X > A < X >::a; // { dg-error "" }