[cfe-dev] More Vexing Than the Most Vexing Parse; Clang Parser Bug?
Seth Cantrell
seth.cantrell at gmail.com
Tue Jul 10 19:07:31 PDT 2012
I'm trying to figure out against whom to file a bug.
This code is parsed differently between Clang, VC++, Comeau, and GCC.
struct A {
A() {}
A(int) {}
};
struct B : A {
void init(int i);
};
void B::init(int i) {
{
A::A(i); // what is this supposed to parse as?
}
}
int main() {
B b;
b.init(2);
}
Clang and an earlier version of GCC parse it a variable declaration, Comeau and current gcc parse it as an illegal constructor call (but since it's illegal is that constructor really "an acceptable lookup result" according to ยง3.4.3.1/2?), and VC++ seems to parse it as constructing a temporary (which it seems hard to fathom how because if A::A is a constructor name then it's not legal to call and does not 'return' a temporary object, but if A::A is a type name then this is a variable declaration).
I'm asking as a result of the discussion at http://stackoverflow.com/questions/11423380/why-are-redundant-class-name-qualifiers-allowed
More information about the cfe-dev
mailing list