[Bug c++/86473] New: a problem in member lookup?
zhonghao at pku dot org.cn
gcc-bugzilla@gcc.gnu.org
Wed Jul 11 00:25:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86473
Bug ID: 86473
Summary: a problem in member lookup?
Product: gcc
Version: 8.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: zhonghao at pku dot org.cn
Target Milestone: ---
The code is as follows:
namespace PR5820 {
struct Base {};
struct D1 : public Base {};
struct D2 : public Base {};
struct Derived : public D1, public D2 {
void Inner() {
}
};
}
template<typename T>
struct BaseT {
int Member;
};
template<typename T> struct Derived1T : BaseT<T> { };
template<typename T> struct Derived2T : BaseT<T> { };
template<typename T>
struct DerivedT : public Derived1T<T>, public Derived2T<T> {
void Inner();
};
template<typename T>
void Test(DerivedT<T> d) {
d.template Derived2T<T>::Member = 17;
}
template void Test(DerivedT<int>);
-------------------------------------
g++ rejects the code:
code0.cpp: In function 'void Test(DerivedT<T>)':
code0.cpp:27:25: error: expected ';' before '::' token
d.template Derived2T<T>::Member = 17;
^~
;
code0.cpp: In instantiation of 'void Test(DerivedT<T>) [with T = int]':
code0.cpp:30:33: required from here
code0.cpp:27:13: error: 'Derived2T' is not a member template function
d.template Derived2T<T>::Member = 17;
~~~~~~~~~~~^~~~~~~~~~~~
This code looks legal for me. Clang++ accepts the code.
More information about the Gcc-bugs
mailing list