http://llvm.org/bugs/show_bug.cgi?id=13684
Bug #: 13684
Summary: Explicitly deleted virtual member function causes link
error
Product: clang
Version: trunk
Platform: All
OS/Version: All
Status: NEW
Severity: normal
Priority: P
Component: C++11
AssignedTo: [email protected]
ReportedBy: [email protected]
CC: [email protected], [email protected]
Classification: Unclassified
cat >test.cc <<EOF
struct Base {
virtual void bar();
virtual void foo() = delete;
};
void Base::bar() { } // a definition of the first non-inline virtual function
int main() { Base b; }
EOF
clang++ -std=c++11 test.cc
Undefined symbols for architecture x86_64:
"Base::foo()", referenced from:
vtable for Base in test-6qnzYL.o
N3337 Section 8.4.3#1 seems fairly clear that a deleted-definition does in fact
count as an (inline) function-definition, which means a deleted definition
satisfies 10.3#11:
> A virtual function declared in a class shall be defined, or declared
> pure in that class, or both; but no diagnostic is required.
However, it seems that Clang disagrees. Clang won't link the following program,
complaining that the definition of `foo` is missing. And if you swap the order
of `foo` and `bar`, Clang complains that the entire vtable is missing
(presumably because Clang thinks `foo` is a non-inline function with no
definition).
cat >test.cc <<EOF
struct Base {
virtual void foo() = delete;
virtual void bar();
};
void Base::bar() { } // still a definition of the first non-inline virtual
function
int main() { Base b; }
EOF
clang++ -std=c++11 test.cc
Undefined symbols for architecture x86_64:
"vtable for Base", referenced from:
Base::Base() in test-FytcYY.o
NOTE: a missing vtable usually means the first non-inline virtual member
function has no definition.
--
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