mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 14:42:11 +02:00
Bug 491842 - Name resolution problem with initializer list
Change-Id: I9a70beb41e9819ca9e980b16249bd080f4d21e97
This commit is contained in:
parent
3b8da01c12
commit
a295702335
2 changed files with 23 additions and 2 deletions
|
@ -8883,6 +8883,22 @@ public class AST2CPPTests extends AST2TestBase {
|
|||
parseAndCheckImplicitNameBindings();
|
||||
}
|
||||
|
||||
// namespace std { template<typename T> class initializer_list; }
|
||||
//
|
||||
// struct A {
|
||||
// A(const char* s);
|
||||
// };
|
||||
//
|
||||
// void waldo(A p);
|
||||
// void waldo(std::initializer_list<A> p);
|
||||
//
|
||||
// void test() {
|
||||
// waldo({""});
|
||||
// }
|
||||
public void testListInitialization_491842() throws Exception {
|
||||
parseAndCheckBindings();
|
||||
}
|
||||
|
||||
// namespace std {
|
||||
// template<typename T> class initializer_list;
|
||||
// }
|
||||
|
|
|
@ -608,7 +608,7 @@ public class Conversions {
|
|||
ICPPConstructor[] filteredConstructors = constructors;
|
||||
if (expandedArgs.length == 1) {
|
||||
filteredConstructors= new ICPPConstructor[constructors.length];
|
||||
int j=0;
|
||||
int j= 0;
|
||||
for (ICPPConstructor ctor : constructors) {
|
||||
if (ctor.getRequiredArgumentCount() < 2) {
|
||||
IType[] ptypes= ctor.getType().getParameterTypes();
|
||||
|
@ -633,6 +633,11 @@ public class Conversions {
|
|||
} else {
|
||||
c= Cost.NO_CONVERSION;
|
||||
}
|
||||
// This cost came from listInitializationSequence() with an std::initializer_list
|
||||
// type as the list initialization target. From the point of view of the caller,
|
||||
// however, the target is the class type, not std::initializer_list, so update it
|
||||
// accordingly.
|
||||
c.setListInitializationTarget(t);
|
||||
return c;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue