[LLVMbugs] [Bug 10506] New: instantiation of '0x for-range statements sloshes together temporaries
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Tue Jul 26 16:05:16 PDT 2011
http://llvm.org/bugs/show_bug.cgi?id=10506
Summary: instantiation of '0x for-range statements sloshes
together temporaries
Product: clang
Version: trunk
Platform: PC
OS/Version: All
Status: NEW
Severity: normal
Priority: P
Component: C++0x
AssignedTo: unassignedclangbugs at nondot.org
ReportedBy: rjmccall at apple.com
CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com
By inspection: TreeTransform on CXXForRangeStmt is not building
CXXExprWithCleanups nodes appropriately for the condition and increment
expressions. Both of these typically would not require temporaries, but they
certainly could if, e.g., the arguments to the equality operator have class
type or the increment expression returns an (ignored) value of class type.
Something like this:
struct needs_temporary {
needs_temporary();
needs_temporary(const needs_temporary &);
~needs_temporary();
};
struct iterator {
needs_temporary temp;
friend bool operator!=(iterator x, iterator y); // or even returning a
temporary with a conversion to bool
needs_temporary operator++();
};
struct has_iterator {};
iterator begin(has_iterator);
iterator end(has_iterator);
template <class T> void test() {
for (auto var : T()) {}
}
template void test<has_iterator>();
--
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.
More information about the llvm-bugs
mailing list