https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85570
Bug ID: 85570
Summary: Resolution of unqualified-id in member access
involving templates fails
Product: gcc
Version: 7.3.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: ambrop7 at gmail dot com
Target Milestone: ---
In the following test program, the resolution of "TheA" in the expression
"b.TheA::func()" fails but should not. According to the C++14 standard in
[basic.lookup.classref] p2, the resolution of unqualified-id "TheA" should be
done in the scope of the class type "B<void>". Therefore it should resolve to
the "TheA" type alias declared in the B class template.
Compilation fails with this error:
main.cpp: In function 'void test()':
main.cpp:13:7: error: 'TheA' has not been declared
b.TheA::func();
^~~~
The code compiles with Clang.
struct A {
void func() {}
};
template <typename T>
struct B : public A {
using TheA = A;
};
template <typename T>
void test() {
B<T> b;
b.TheA::func();
}
int main() {
test<void>();
return 0;
}