* C++ PATCH for c++/77339, ICE with invalid use of alias template
@ 2017-03-24 15:37 Jason Merrill
0 siblings, 0 replies; only message in thread
From: Jason Merrill @ 2017-03-24 15:37 UTC (permalink / raw)
To: gcc-patches List
[-- Attachment #1: Type: text/plain, Size: 288 bytes --]
Here, we were seeing that A<X>:: is a template specialization, so we
tried to treat it as entering the scope of A<X>. But since A is an
alias template, that doesn't make sense. Fixed by not considering
alias templates for this treatment.
Tested x86_64-pc-linux-gnu, applying to trunk.
[-- Attachment #2: 77339.diff --]
[-- Type: text/plain, Size: 1295 bytes --]
commit 7fde9bb020c7be786c791e485261e28e7b0d3ccf
Author: Jason Merrill <jason@redhat.com>
Date: Thu Mar 23 16:21:34 2017 -0400
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.
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 "" }
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2017-03-24 14:22 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-24 15:37 C++ PATCH for c++/77339, ICE with invalid use of alias template Jason Merrill
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).