Summary: | [4.7/4.8 Regression] [C++11] seg fault when specifying using decltype(...)::method | ||
---|---|---|---|
Product: | gcc | Reporter: | Daniel Larimer <dlarimer> |
Component: | c++ | Assignee: | Jason Merrill <jason> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | jason, jason |
Priority: | P3 | Keywords: | ice-on-invalid-code |
Version: | 4.7.0 | ||
Target Milestone: | 4.7.2 | ||
Host: | Target: | ||
Build: | Known to work: | 4.6.3 | |
Known to fail: | 4.7.0, 4.8.0 | Last reconfirmed: | 2012-06-13 00:00:00 |
Attachments: | Source file that generated the error. |
Description
Daniel Larimer
2012-06-13 01:17:25 UTC
The code is has about a dozen errors, the one that causes the ICE is that the decltype-specifier is a reference not a class, and you can't derive from a reference. Reduced: template<typename> struct wrap { void bar(); }; template<typename T> auto foo(T* t) -> wrap<T>* { return 0; } template<typename T> struct holder : decltype(*foo((T*)0)) { using decltype(*foo((T*)0))::bar; }; holder<int> h; This is a regression because 4.6.3 doesn't ICE, although the diagnostic isn't very helpful in telling you the decltype-specifier is a reference type: s2.cc:8:11: error: expected nested-name-specifier before ‘decltype’ s2.cc:8:11: error: expected unqualified-id before ‘decltype’ s2.cc:8:11: error: expected ‘;’ before ‘decltype’ s2.cc:8:34: error: invalid use of ‘::’ It is caused by revision 176513: http://gcc.gnu.org/ml/gcc-cvs/2011-07/msg00780.html Author: jason Date: Wed Jun 20 01:17:59 2012 New Revision: 188807 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=188807 Log: PR c++/53651 * name-lookup.c (constructor_name_p): Don't try to look at the name of a DECLTYPE_TYPE. Added: trunk/gcc/testsuite/g++.dg/cpp0x/decltype37.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/name-lookup.c trunk/gcc/testsuite/ChangeLog Author: jason Date: Wed Jun 20 07:22:34 2012 New Revision: 188813 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=188813 Log: PR c++/53651 * name-lookup.c (constructor_name_p): Don't try to look at the name of a DECLTYPE_TYPE. Added: branches/gcc-4_7-branch/gcc/testsuite/g++.dg/cpp0x/decltype37.C Modified: branches/gcc-4_7-branch/gcc/cp/ChangeLog branches/gcc-4_7-branch/gcc/cp/name-lookup.c branches/gcc-4_7-branch/gcc/testsuite/ChangeLog Fixed for 4.7.2. |