This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/57846] CRTP, templates, metaprogramming, forwarding and static member
- From: "harald at gigawatt dot nl" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sat, 13 Dec 2014 16:42:00 +0000
- Subject: [Bug c++/57846] CRTP, templates, metaprogramming, forwarding and static member
- Auto-submitted: auto-generated
- References: <bug-57846-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57846
Harald van Dijk <harald at gigawatt dot nl> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |harald at gigawatt dot nl
--- Comment #3 from Harald van Dijk <harald at gigawatt dot nl> ---
Somewhat reduced:
template <typename T>
struct A
{
template <typename T2>
void f();
};
template <typename T>
struct B
{
int &f() const;
template <typename T2 = T, typename = decltype(A<T2>().template f<T2>(T2()))>
void f();
void g() {
int *i = &B<int>().f();
}
};
Accepted by clang 3.4.2, rejected by gcc 4.8.3 and 4.9.0 with:
test.cc: In member function âvoid B<T>::g()â:
test.cc:17:26: error: lvalue required as unary â&â operand
It seems to only happen when certain operators are used: there is no error when
doing e.g.
int &i = B<int>().f();