[Bug c++/61500] New: [C++11] [4.8/4.9 Regression] Can't take pointer to member referenced via member pointer template parameter.
vmarko at google dot com
gcc-bugzilla@gcc.gnu.org
Fri Jun 13 15:18:00 GMT 2014
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61500
Bug ID: 61500
Summary: [C++11] [4.8/4.9 Regression] Can't take pointer to
member referenced via member pointer template
parameter.
Product: gcc
Version: 4.9.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: vmarko at google dot com
struct X {
int i;
int j;
int foo(int X::* ptr);
template <int X::* ptr>
int bar();
};
int X::foo(int X::* ptr) {
int* p = &(this->*ptr); // OK.
return *p;
}
template <int X::* ptr>
int X::bar() {
int* p = &(this->*ptr); // gcc 4.9.0: OK in C++98 mode, fails in C++11 mode.
return *p;
}
gcc 4.9.0, C++11:
test.cc:18:24: error: lvalue required as unary '&' operand
Reproduced with gcc 4.9.0 from AOSP prebuilts (aarch64-linux-android) and gcc
4.8.0 from AOSP prebuilts (x86_64-linux-android). Works fine with gcc 4.6.3 on
host (x86_64-linux-gnu).
More information about the Gcc-bugs
mailing list