[llvm-bugs] [Bug 26893] New: sizeof non-static member of struct nested within class template (-std=c++11)
via llvm-bugs
llvm-bugs at lists.llvm.org
Wed Mar 9 14:36:49 PST 2016
https://llvm.org/bugs/show_bug.cgi?id=26893
Bug ID: 26893
Summary: sizeof non-static member of struct nested within class
template (-std=c++11)
Product: clang
Version: 3.6
Hardware: PC
OS: Windows NT
Status: NEW
Severity: normal
Priority: P
Component: C++11
Assignee: unassignedclangbugs at nondot.org
Reporter: bobmoretti at gmail.com
CC: dgregor at apple.com, llvm-bugs at lists.llvm.org
Classification: Unclassified
In clang/llvm 3.6.2, the following code results in a compilation error when
compiling with std=c++11:
template <typename T=void>
class bar
{
public:
struct foo
{
int array[10];
};
int baz()
{
return sizeof(foo::array);
}
};
int main(void)
{
bar<> b;
return b.baz();
}
The same code compiles cleanly if I make bar a simple class and not a template.
Stack overflow user ecatmur also posted a reduced example:
template<class T> struct M { int f() { return sizeof(T::x); } };
struct S { int x; };
int main() { return M<S>{}.f(); }
--
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/20160309/3c70447f/attachment.html>
More information about the llvm-bugs
mailing list