http://llvm.org/bugs/show_bug.cgi?id=16078
Bug ID: 16078
Summary: detect some invalid odr-uses during template
definition
Product: clang
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: C++
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected], [email protected]
Classification: Unclassified
Clang accepts this:
template<typename T> void f() {
int n;
struct X { int get() { return n; } };
}
This is ill-formed (NDR) because the mention of 'n' inside X is always an
odr-use, and thus is always invalid. We need to be careful in cases which might
not be odr-uses; for instance, this is valid:
template<typename T> int f() {
T n = 0;
struct X { int get() { return n; } } x;
return x.get();
}
int k = f<const int>();
--
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