[LLVMbugs] [Bug 16078] New: detect some invalid odr-uses during template definition
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Mon May 20 15:46:51 PDT 2013
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: unassignedclangbugs at nondot.org
Reporter: richard-llvm at metafoo.co.uk
CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20130520/35f48138/attachment.html>
More information about the llvm-bugs
mailing list