From c54b6de1ac4d9bb3be10237bae71850f3483e7fe Mon Sep 17 00:00:00 2001 From: Patrick Palka Date: Mon, 13 Jul 2015 20:35:53 +0000 Subject: Fix PR c++/65186 gcc/cp/ChangeLog: PR c++/65186 * pt.c (invalid_nontype_parm_type_p): Accept a bound template template parm type under C++11 and later. gcc/testsuite/ChangeLog: PR c++/65186 * g++.dg/template/pr65186.C: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@225749 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/cp/ChangeLog | 6 ++++++ gcc/cp/pt.c | 5 +++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/template/pr65186.C | 26 ++++++++++++++++++++++++++ 4 files changed, 42 insertions(+) create mode 100644 gcc/testsuite/g++.dg/template/pr65186.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index a33b6491876..df2e0b2fabf 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2015-07-13 Patrick Palka + + PR c++/65186 + * pt.c (invalid_nontype_parm_type_p): Accept a bound template + template parm type under C++11 and later. + 2015-07-12 Aldy Hernandez * call.c: Fix double word typos. diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 064cbfdc4ec..2097963ed69 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -20996,6 +20996,11 @@ invalid_nontype_parm_type_p (tree type, tsubst_flags_t complain) return 0; else if (TREE_CODE (type) == NULLPTR_TYPE) return 0; + /* A bound template template parm could later be instantiated to have a valid + nontype parm type via an alias template. */ + else if (cxx_dialect >= cxx11 + && TREE_CODE (type) == BOUND_TEMPLATE_TEMPLATE_PARM) + return 0; if (complain & tf_error) { diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 071e7c4e08f..2e32e14527e 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2015-07-13 Patrick Palka + + PR c++/65186 + * g++.dg/template/pr65186.C: New test. + 2015-07-13 Mantas Mikaitis * gcc.target/arm/macro_defs0.c: Add directive to skip diff --git a/gcc/testsuite/g++.dg/template/pr65186.C b/gcc/testsuite/g++.dg/template/pr65186.C new file mode 100644 index 00000000000..f5e81e37eba --- /dev/null +++ b/gcc/testsuite/g++.dg/template/pr65186.C @@ -0,0 +1,26 @@ +// { dg-do compile { target c++11 } } +// PR c++/65186 + +template +using Id = int; + +template< + typename A, + A x, + A y, + Id p, + template> class C, + C // { dg-bogus "not a valid type" } +> using J = C; + + +template +using Z = A; + +template< + template class A, + A B // { dg-bogus "not a valid type" } +> +struct C { }; + +C a; -- cgit v1.2.3