PR c++/71511 - ICE on decltype scope in declaration.
authorJason Merrill <jason@redhat.com>
Fri, 15 Jul 2016 18:38:48 +0000 (14:38 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Fri, 15 Jul 2016 18:38:48 +0000 (14:38 -0400)
* typeck2.c (cxx_incomplete_type_diagnostic): Handle DECLTYPE_TYPE.

From-SVN: r238393

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

index 84106b82a4332affd41a6aeab346e6cf5bc247c0..0178f108f6c7e7783bfc1120766287658bf6c695 100644 (file)
@@ -1,5 +1,8 @@
 2016-07-15  Jason Merrill  <jason@redhat.com>
 
+       PR c++/71511
+       * typeck2.c (cxx_incomplete_type_diagnostic): Handle DECLTYPE_TYPE.
+
        PR c++/71513
        * pt.c (tsubst_attributes): Fix loop logic.
 
index b1206c09a0e35551a42f831ff3eab0d8220fb970..b9dc56d01c385295147961aa6a5b49bb9a09066d 100644 (file)
@@ -537,6 +537,7 @@ cxx_incomplete_type_diagnostic (location_t loc, const_tree value,
       break;
 
     case TYPENAME_TYPE:
+    case DECLTYPE_TYPE:
       emit_diagnostic (diag_kind, loc, 0,
                       "invalid use of dependent type %qT", type);
       break;
diff --git a/gcc/testsuite/g++.dg/cpp0x/decltype65.C b/gcc/testsuite/g++.dg/cpp0x/decltype65.C
new file mode 100644 (file)
index 0000000..85f635a
--- /dev/null
@@ -0,0 +1,11 @@
+// PR c++/71511
+// { dg-do compile { target c++11 } }
+
+template < typename T > 
+class A 
+{   
+  static int i;   
+};
+
+//okay: template < typename T > int A <T>::i = 100;
+template < typename T > int decltype (A < T > ())::i = 100; // { dg-error "decltype" }