mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-06 17:26:01 +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
|
@ -8882,7 +8882,23 @@ public class AST2CPPTests extends AST2TestBase {
|
||||||
public void testListInitialization_458679() throws Exception {
|
public void testListInitialization_458679() throws Exception {
|
||||||
parseAndCheckImplicitNameBindings();
|
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 {
|
// namespace std {
|
||||||
// template<typename T> class initializer_list;
|
// template<typename T> class initializer_list;
|
||||||
// }
|
// }
|
||||||
|
|
|
@ -608,7 +608,7 @@ public class Conversions {
|
||||||
ICPPConstructor[] filteredConstructors = constructors;
|
ICPPConstructor[] filteredConstructors = constructors;
|
||||||
if (expandedArgs.length == 1) {
|
if (expandedArgs.length == 1) {
|
||||||
filteredConstructors= new ICPPConstructor[constructors.length];
|
filteredConstructors= new ICPPConstructor[constructors.length];
|
||||||
int j=0;
|
int j= 0;
|
||||||
for (ICPPConstructor ctor : constructors) {
|
for (ICPPConstructor ctor : constructors) {
|
||||||
if (ctor.getRequiredArgumentCount() < 2) {
|
if (ctor.getRequiredArgumentCount() < 2) {
|
||||||
IType[] ptypes= ctor.getType().getParameterTypes();
|
IType[] ptypes= ctor.getType().getParameterTypes();
|
||||||
|
@ -633,6 +633,11 @@ public class Conversions {
|
||||||
} else {
|
} else {
|
||||||
c= Cost.NO_CONVERSION;
|
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;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue