From 90471a3d8330dff361297f72fa95c157e26ea345 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Fri, 24 Mar 2017 10:40:13 -0400 Subject: [PATCH] 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 --- gcc/cp/ChangeLog | 6 ++++++ gcc/cp/pt.c | 4 ++-- gcc/testsuite/g++.dg/cpp0x/alias-decl-58.C | 7 +++++++ 3 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/g++.dg/cpp0x/alias-decl-58.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index f8e711b160a..ea1eaa771a5 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2017-03-24 Jason Merrill + + 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 PR c++/80119 diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 5259dad72a0..cbe80821b54 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 00000000000..0ae1c499bd5 --- /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 "" } -- 2.30.2