This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/52748] [4.9 Regression][C++11] N3276 changes to decltype
- From: "zeratul976 at hotmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 10 Apr 2013 09:27:10 +0000
- Subject: [Bug c++/52748] [4.9 Regression][C++11] N3276 changes to decltype
- Auto-submitted: auto-generated
- References: <bug-52748-4 at http dot gcc dot gnu dot org/bugzilla/>
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.