[Bug c++/53651] [4.7/4.8 Regression] [C++11] seg fault when specifying using decltype(...)::method

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Jun 13 10:01:00 GMT 2012


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53651

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice-on-invalid-code
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2012-06-13
      Known to work|                            |4.6.3
            Summary|seg fault when specifying   |[4.7/4.8 Regression]
                   |using decltype(...)::method |[C++11] seg fault when
                   |                            |specifying using
                   |                            |decltype(...)::method
     Ever Confirmed|0                           |1
      Known to fail|                            |4.7.0, 4.8.0

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-06-13 10:01:11 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 ‘::’



More information about the Gcc-bugs mailing list