[LLVMbugs] [Bug 20350] New: wrong initialization after template instantiation for aggregate initialization that implicitly default-constructs
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Thu Jul 17 17:18:23 PDT 2014
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: unassignedclangbugs at nondot.org
Reporter: richard-llvm at metafoo.co.uk
CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20140718/5649fd3a/attachment.html>
More information about the llvm-bugs
mailing list