/cp
authorpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 1 May 2013 09:21:30 +0000 (09:21 +0000)
committerpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 1 May 2013 09:21:30 +0000 (09:21 +0000)
2013-05-01  Paolo Carlini  <paolo.carlini@oracle.com>

PR c++/57092
* semantics.c (finish_decltype_type): Handle instantiated template
non-type arguments.

/testsuite
2013-05-01  Paolo Carlini  <paolo.carlini@oracle.com>

PR c++/57092
* g++.dg/cpp0x/decltype53.C: New.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@198487 138bc75d-0d04-0410-961f-82ee72b054a4

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

index c614ebe..09f10df 100644 (file)
@@ -1,3 +1,9 @@
+2013-05-01  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/57092
+       * semantics.c (finish_decltype_type): Handle instantiated template
+       non-type arguments.
+
 2013-04-28  Paolo Carlini  <paolo.carlini@oracle.com>
 
        PR c++/56450
index 2a0d5bc..a06a23a 100644 (file)
@@ -5416,8 +5416,9 @@ finish_decltype_type (tree expr, bool id_expression_or_member_access_p,
           break;
 
         default:
-         gcc_unreachable ();
-          return error_mark_node;
+         /* Handle instantiated template non-type arguments.  */
+         type = TREE_TYPE (expr);
+          break;
         }
     }
   else
index 1016036..e8c71e5 100644 (file)
@@ -1,3 +1,8 @@
+2013-05-01  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/57092
+       * g++.dg/cpp0x/decltype53.C: New.
+
 2013-04-30  Thomas Koenig  <tkoenig@gcc.gnu.org>
 
        PR fortran/57071
diff --git a/gcc/testsuite/g++.dg/cpp0x/decltype53.C b/gcc/testsuite/g++.dg/cpp0x/decltype53.C
new file mode 100644 (file)
index 0000000..4580e97
--- /dev/null
@@ -0,0 +1,11 @@
+// PR c++/57092
+// { dg-do compile { target c++11 } }
+
+template <void (*F)(int)>
+class B {
+  decltype(F) v;
+};
+
+void foo(int) {}
+
+B<foo> o;