From: Jason Merrill Date: Fri, 15 Jul 2016 18:38:48 +0000 (-0400) Subject: PR c++/71511 - ICE on decltype scope in declaration. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=2a54351ba7f9a90ede3dbc6dd2e15272b955fdd1;p=gcc.git PR c++/71511 - ICE on decltype scope in declaration. * typeck2.c (cxx_incomplete_type_diagnostic): Handle DECLTYPE_TYPE. From-SVN: r238393 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 84106b82a43..0178f108f6c 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,8 @@ 2016-07-15 Jason Merrill + 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 b1206c09a0e..b9dc56d01c3 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 00000000000..85f635a91fb --- /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 ::i = 100; +template < typename T > int decltype (A < T > ())::i = 100; // { dg-error "decltype" }