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: [email protected]
ReportedBy: [email protected]
CC: [email protected], [email protected]
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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs