This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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

Nathan Ridge <zeratul976 at hotmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|FIXED                       |

--- Comment #14 from Nathan Ridge <zeratul976 at hotmail dot com> 2013-04-10 09:27:10 UTC ---
Here is a related example that still fails to compile:


template <int> struct A;

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

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

struct S
{
    struct F
    {
        typedef S type;
    };

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



This is compiled successfully by clang, but GCC (4.9, r197663) gives the
following error:

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


If the operator- is replaced by a non-operator function, GCC compiles the
example successfully, which leads me to believe it's a bug.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]