re PR c++/48617 ([C++0x] Problem with non-type template parameters and decltype)
authorJason Merrill <jason@redhat.com>
Mon, 23 May 2011 15:32:10 +0000 (11:32 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Mon, 23 May 2011 15:32:10 +0000 (11:32 -0400)
PR c++/48617
* pt.c (invalid_nontype_parm_type_p): Allow DECLTYPE_TYPE.

From-SVN: r174070

gcc/cp/ChangeLog
gcc/cp/pt.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp0x/decltype27.C [new file with mode: 0644]

index 168f43a245d220023318f65e1583bf31eeed7c91..a1b0aec802d09b79a2024530f5c439740af61243 100644 (file)
@@ -1,3 +1,8 @@
+2011-05-23  Jason Merrill  <jason@redhat.com>
+
+       PR c++/48617
+       * pt.c (invalid_nontype_parm_type_p): Allow DECLTYPE_TYPE.
+
 2011-05-23  Nathan Froyd  <froydnj@codesourcery.com>
 
        * call.c (build_over_call): Tweak call to check_function_arguments.
index d72596f55255bb80a95a4c77f1b519448e9bd042..380b21efbca9bd60f40b1345ceb80ac7de540ed3 100644 (file)
@@ -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);
index be8b2eac0364e1eb81925a32d1852108cbfaabce..47f0dac09912412cc4f8742bb5a216acb342bad3 100644 (file)
@@ -1,3 +1,7 @@
+2011-05-23  Jason Merrill  <jason@redhat.com>
+
+       * g++.dg/cpp0x/decltype27.C: New.
+
 2011-05-23  Richard Guenther  <rguenther@suse.de>
 
        * 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 (file)
index 0000000..cb962ad
--- /dev/null
@@ -0,0 +1,9 @@
+// PR c++/48617
+// { dg-options -std=c++0x }
+
+template<class T, decltype(T())> // #
+struct A {};
+
+A<int, 0> a;
+
+int main() {}