[Bug c++/52748] [4.9 Regression][C++11] N3276 changes to decltype

zeratul976 at hotmail dot com gcc-bugzilla@gcc.gnu.org
Fri Apr 12 07:22:00 GMT 2013


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

--- Comment #16 from Nathan Ridge <zeratul976 at hotmail dot com> 2013-04-12 07:22:20 UTC ---
(In reply to comment #15)
> (In reply to comment #14)
> > Here is a related example that still fails to compile:
> 
> Fixed.

It still fails if we make S a template:


template <int> struct A;

template <typename T> struct B : A<sizeof(T)> {};

template <typename F>
B<typename F::type> operator-(F);

template <typename T>
struct S
{
    struct F
    {
        typedef S type;
    };

    auto foo() -> decltype(-F());
};

int main()
{   
    S<int> s;
}


test.cpp: In instantiation of 'struct B<S<int> >':
test.cpp:16:28:   required from 'struct S<int>'
test.cpp:21:12:   required from here
test.cpp:3:42: error: invalid application of 'sizeof' to incomplete type
'S<int>'
 template <typename T> struct B : A<sizeof(T)> {};
                                          ^

Tested with r197837.



More information about the Gcc-bugs mailing list