[LLVMbugs] [Bug 20855] New: tuple with a reference to a temporary (C++11): static_assert: "Attempted to construct a reference element in a tuple with an rvalue"
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Fri Sep 5 06:07:05 PDT 2014
http://llvm.org/bugs/show_bug.cgi?id=20855
Bug ID: 20855
Summary: tuple with a reference to a temporary (C++11):
static_assert: "Attempted to construct a reference
element in a tuple with an rvalue"
Product: libc++
Version: unspecified
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P
Component: All Bugs
Assignee: unassignedclangbugs at nondot.org
Reporter: mark at chromium.org
CC: llvmbugs at cs.uiuc.edu, mclow.lists at gmail.com
Classification: Unclassified
Created attachment 12993
--> http://llvm.org/bugs/attachment.cgi?id=12993&action=edit
Testcase
When creating a tuple that contains a reference to a temporary, this
static_assert is triggered:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/tuple:210:10:
error:
static_assert failed "Attempted to construct a reference element in a
tuple with an rvalue"
{static_assert(!is_reference<_Hp>::value ||
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This check seems overzealous. In my seemingly-valid code, the temporary in
question outlives the reference to it, and there doesn’t appear to be any
reason to restrict this.
A testcase is attached. It can be built with “clang++ -std=c++11
-stdlib=libc++”.
--
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/20140905/bac6ce1d/attachment.html>
More information about the llvm-bugs
mailing list