diff options
author | dodji <dodji@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-11-20 07:10:24 +0000 |
---|---|---|
committer | dodji <dodji@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-11-20 07:10:24 +0000 |
commit | 14bf3817ddada5f91772d3fb4a7889169f59c7ba (patch) | |
tree | bc79e57074c519761cbdad6d84718baf024059ab | |
parent | 5b4a4a6a31dc191014f46c4176941c7f36b99764 (diff) | |
download | gcc-14bf3817ddada5f91772d3fb4a7889169f59c7ba.tar.gz |
PR c++/51194 - ICE with invalid alias template
gcc/cp/
PR c++/51194
* pt.c (lookup_template_class_1): Go out early if the type of the
template is error_mark_node.
gcc/testsuite/
PR c++/51194
* g++.dg/cpp0x/alias-decl-15.C: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@181523 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/pt.c | 6 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp0x/alias-decl-15.C | 17 |
4 files changed, 34 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 3d0f356244c..96e4d20a1d7 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2011-11-20 Dodji Seketeli <dodji@redhat.com> + + PR c++/51194 + * pt.c (lookup_template_class_1): Go out early if the type of the + template is error_mark_node. + 2011-11-19 Paolo Carlini <paolo.carlini@oracle.com> PR c++/51216 diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 987b70b7ba4..2b02fa4269d 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -7270,6 +7270,12 @@ lookup_template_class_1 (tree d1, tree arglist, tree in_decl, tree context, int is_dependent_type; int use_partial_inst_tmpl = false; + if (template_type == error_mark_node) + /* An error occured while building the template TEMPL, and a + diagnostic has most certainly been emitted for that + already. Let's propagate that error. */ + return error_mark_node; + gen_tmpl = most_general_template (templ); parmlist = DECL_TEMPLATE_PARMS (gen_tmpl); parm_depth = TMPL_PARMS_DEPTH (parmlist); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 861f36c4c41..c5f33a6216e 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2011-11-20 Dodji Seketeli <dodji@redhat.com> + + PR c++/51194 + * g++.dg/cpp0x/alias-decl-15.C: New test. + 2011-11-19 Paolo Carlini <paolo.carlini@oracle.com> PR c++/51216 diff --git a/gcc/testsuite/g++.dg/cpp0x/alias-decl-15.C b/gcc/testsuite/g++.dg/cpp0x/alias-decl-15.C new file mode 100644 index 00000000000..2bc9b11843d --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/alias-decl-15.C @@ -0,0 +1,17 @@ +// Origin PR c++/51194 +// { dg-options "-std=c++0x" } + +template<class U, class V> //#1 +struct foo {}; // { dg-error "provided for|foo" } + +template<class U, class V=char> +struct P {}; + +template<template<class... U> class... TT> +struct bar { + template<class... Args> + using mem = P<TT<Args...>...>;//#2 { dg-error "wrong number of|arguments" } +}; + +bar<foo>::mem<int, char> b;//#3 { dg-error "invalid type" } + |