aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2016-07-15 14:38:48 -0400
committerJason Merrill <jason@gcc.gnu.org>2016-07-15 14:38:48 -0400
commit2a54351ba7f9a90ede3dbc6dd2e15272b955fdd1 (patch)
tree04809c1d4b70c21ce66fa42a22bfa6fb120ad9a7 /gcc
parent1019d191806b61fb07a4197bf769b4508a572d9c (diff)
downloadgcc-2a54351ba7f9a90ede3dbc6dd2e15272b955fdd1.zip
gcc-2a54351ba7f9a90ede3dbc6dd2e15272b955fdd1.tar.gz
gcc-2a54351ba7f9a90ede3dbc6dd2e15272b955fdd1.tar.bz2
PR c++/71511 - ICE on decltype scope in declaration.
* typeck2.c (cxx_incomplete_type_diagnostic): Handle DECLTYPE_TYPE. From-SVN: r238393
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog3
-rw-r--r--gcc/cp/typeck2.c1
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/decltype65.C11
3 files changed, 15 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 84106b8..0178f10 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -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.
diff --git a/gcc/cp/typeck2.c b/gcc/cp/typeck2.c
index b1206c0..b9dc56d 100644
--- a/gcc/cp/typeck2.c
+++ b/gcc/cp/typeck2.c
@@ -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
index 0000000..85f635a
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/decltype65.C
@@ -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" }