http://llvm.org/bugs/show_bug.cgi?id=8292
Summary: Clang does not sufficiently check completely
defined-ness of class template
Product: clang
Version: trunk
Platform: PC
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P
Component: C++
AssignedTo: [email protected]
ReportedBy: [email protected]
CC: [email protected], [email protected]
This template definition is rejected by comeau and GCC but not really by Clang
template <class T>
struct A
{
struct B { };
void f() { }
struct C {
int c[sizeof(A<int>::B)];
};
void g() { }
};
int main() {
A<int> b;
b.f();
b.g();
}
Clang does accept all the code up to until "b.g()" complaining that "g" was not
declared:
main1.cpp:18:5: error: no member named 'g' in 'A<int>'
b.g();
It appears to me that it causes an implicit instantiation of A<int> at
"sizeof(A<int>::B)" and instantiates declarations of A<int> for up to until
A::C, ignoring any data and function members declared past A::C.
I think this example is ill-formed already at "sizeof(A<int>::B)" by
[temp.inst]p6 "If an implicit instantiation of a class template specialization
is required and the template is declared but not defined, the program is
ill-formed.".
This also makes the second example of PR7308 which writes "friend
A<int>::operator A<double>();" ill-formed.
--
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs