From 08dc4c3dd7dd26d711a100abb6b0fe78dc712f99 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Mon, 23 May 2011 11:32:10 -0400 Subject: [PATCH] re PR c++/48617 ([C++0x] Problem with non-type template parameters and decltype) PR c++/48617 * pt.c (invalid_nontype_parm_type_p): Allow DECLTYPE_TYPE. From-SVN: r174070 --- gcc/cp/ChangeLog | 5 +++++ gcc/cp/pt.c | 2 ++ gcc/testsuite/ChangeLog | 4 ++++ gcc/testsuite/g++.dg/cpp0x/decltype27.C | 9 +++++++++ 4 files changed, 20 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp0x/decltype27.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 168f43a245d..a1b0aec802d 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2011-05-23 Jason Merrill + + PR c++/48617 + * pt.c (invalid_nontype_parm_type_p): Allow DECLTYPE_TYPE. + 2011-05-23 Nathan Froyd * call.c (build_over_call): Tweak call to check_function_arguments. diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index d72596f5525..380b21efbca 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -18089,6 +18089,8 @@ invalid_nontype_parm_type_p (tree type, tsubst_flags_t complain) return 0; else if (TREE_CODE (type) == TYPENAME_TYPE) return 0; + else if (TREE_CODE (type) == DECLTYPE_TYPE) + return 0; if (complain & tf_error) error ("%q#T is not a valid type for a template constant parameter", type); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index be8b2eac036..47f0dac0991 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2011-05-23 Jason Merrill + + * g++.dg/cpp0x/decltype27.C: New. + 2011-05-23 Richard Guenther * gcc.dg/tree-ssa/forwprop-11.c: Adjust and un-XFAIL. diff --git a/gcc/testsuite/g++.dg/cpp0x/decltype27.C b/gcc/testsuite/g++.dg/cpp0x/decltype27.C new file mode 100644 index 00000000000..cb962ada525 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/decltype27.C @@ -0,0 +1,9 @@ +// PR c++/48617 +// { dg-options -std=c++0x } + +template // # +struct A {}; + +A a; + +int main() {} -- 2.30.2