http://llvm.org/bugs/show_bug.cgi?id=20350
Bug ID: 20350
Summary: wrong initialization after template instantiation for
aggregate initialization that implicitly
default-constructs
Product: clang
Version: unspecified
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 rejects-valid on this:
namespace NoExtraCopy {
struct S { S(); S(const S&) = delete; };
struct T { S s; };
template<typename> void f() {
T t = {};
}
template void f<int>();
}
... because the template instantiation of the initializer initializes the S
subobject from the existing CXXConstructExpr, resulting in an unnecessary move
construction.
We should either make TreeTransform::TransformInitializer recurse through
InitListExprs (and throw away things that were implied), or (better) not redo
initialization sequence formation during template instantiation if we succeeded
in building the initialization sequence in the initial parse.
(In the latter case, we'd probably benefit from an AST node representing a
dependent initialization sequence, so we can get TreeTransform to rerun the
initialization step where needed.)
--
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