http://llvm.org/bugs/show_bug.cgi?id=14428
Bug #: 14428
Summary: clang instantiates arguments of all constructors in
presence of constructor with default argument
Product: clang
Version: unspecified
Platform: PC
OS/Version: All
Status: NEW
Severity: normal
Priority: P
Component: C++
AssignedTo: [email protected]
ReportedBy: [email protected]
CC: [email protected], [email protected],
[email protected]
Classification: Unclassified
>From r168521:
template <typename T> struct move_from {
T invalid;
};
template <class K>
struct unordered_map {
explicit unordered_map(int n = 42);
unordered_map(move_from<K> other);
};
template<typename T>
void StripedHashTable() {
new unordered_map<void>();
}
void tt() {
StripedHashTable<int>();
}
clang instantiates move_from<void> and emits an error. GCC and EDG accept this
code, so does the clang 3.0 from llvm.org/demo.
r168521 can probably be reverted when this is fixed.
Richard says:
> Looking just at what you needed to change in your patch, my wild guess
> is that we might be trying to initialize an unordered_map object from
> the default argument expression '42', rather than trying to initialize
> the 'n' parameter of the explicit constructor from it. That would
> explain why we instantiate move_from<K>: we'd be trying to use the
> second constructor to convert '42' to an unordered_map, but would be a
> very surprising bug to have...
--
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