http://llvm.org/bugs/show_bug.cgi?id=12498
Bug #: 12498
Summary: clang erroneously compiles conversion of
initializer_list to forward-declared class
Product: clang
Version: trunk
Platform: Macintosh
OS/Version: MacOS X
Status: NEW
Severity: normal
Priority: P
Component: C++11
AssignedTo: [email protected]
ReportedBy: [email protected]
CC: [email protected], [email protected]
Classification: Unclassified
The following program compiles with clang r154288, even though it shouldn't:
class ArrayRef;
struct C {
void foo(const ArrayRef&); // (Mis-)compiles
//void foo(ArrayRef); // Error
};
static void bar(C* c)
{
c->foo({ nullptr, 1 });
}
int main(int, char**)
{
bar(nullptr);
}
This should result in a compile error, as ArrayRef is merely forward-declared
and thus has no constructor that could be called in bar. Instead, clang simply
drops the call to "foo" (taken from Shark's static analyzer, no optimizations):
bar(C*):
pushq %rbp
movq %rsp, %rbp
movq %rdi, -8(%rbp)
popq %rbp
ret
When foo expects the ArrayRef by value instead of by const reference, clang
correctly raises a compile error.
--
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