mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-16 20:55:44 +02:00
Fix argument deduction, example 14.8.2.4-14, related to bug 256113.
This commit is contained in:
parent
45f3fe8e97
commit
57ed777b6c
4 changed files with 25 additions and 22 deletions
|
@ -73,19 +73,4 @@ public class AST2CPPSpecFailingTest extends AST2SpecBaseTest {
|
||||||
public void _test14_8_2_4s8() throws Exception {
|
public void _test14_8_2_4s8() throws Exception {
|
||||||
parse(getAboveComment(), ParserLanguage.CPP, true, 0);
|
parse(getAboveComment(), ParserLanguage.CPP, true, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// template<int i, typename T>
|
|
||||||
// T deduce(typename A<T>::X x, // T is not deduced here
|
|
||||||
// T t, // but T is deduced here
|
|
||||||
// typename B<i>::Y y); // i is not deduced here
|
|
||||||
// A<int> a;
|
|
||||||
// B<77> b;
|
|
||||||
// int x = deduce<77>(a.xm, 62, y.ym);
|
|
||||||
// // T is deduced to be int, a.xm must be convertible to
|
|
||||||
// // A<int>::X
|
|
||||||
// // i is explicitly specified to be 77, y.ym must be convertible
|
|
||||||
// // to B<77>::Y
|
|
||||||
public void _test14_8_2_4s14() throws Exception {
|
|
||||||
parse(getAboveComment(), ParserLanguage.CPP, true, 0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5667,6 +5667,29 @@ public class AST2CPPSpecTest extends AST2SpecBaseTest {
|
||||||
parse(getAboveComment(), ParserLanguage.CPP, false, 0);
|
parse(getAboveComment(), ParserLanguage.CPP, false, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// template<typename T> class A {
|
||||||
|
// public:
|
||||||
|
// typedef int X;
|
||||||
|
// X xm;
|
||||||
|
// };
|
||||||
|
// template<int I> class B {
|
||||||
|
// public:
|
||||||
|
// typedef int* Y;
|
||||||
|
// Y ym;
|
||||||
|
// };
|
||||||
|
// template<int i, typename T>
|
||||||
|
// T deduce(typename A<T>::X x, // T is not deduced here
|
||||||
|
// T t, // but T is deduced here
|
||||||
|
// typename B<i>::Y y); // i is not deduced here
|
||||||
|
// void test() {
|
||||||
|
// A<int> a;
|
||||||
|
// B<77> b;
|
||||||
|
// deduce<77> (a.xm, 62, b.ym);
|
||||||
|
// }
|
||||||
|
public void test14_8_2_4s14() throws Exception {
|
||||||
|
parse(getAboveComment(), ParserLanguage.CPP, true, 0);
|
||||||
|
}
|
||||||
|
|
||||||
// template<int i> class A { /* ... */ };
|
// template<int i> class A { /* ... */ };
|
||||||
// template<short s> void f(A<s>);
|
// template<short s> void f(A<s>);
|
||||||
// void k1() {
|
// void k1() {
|
||||||
|
|
|
@ -348,12 +348,7 @@ public class IndexCBindingResolutionTest extends IndexBindingResolutionTestBase
|
||||||
IBinding b10 = getBindingFromASTName("foo1/*k*/", 4);
|
IBinding b10 = getBindingFromASTName("foo1/*k*/", 4);
|
||||||
IBinding b10a = getBindingFromASTName("sp);/*9*/ ", 2);
|
IBinding b10a = getBindingFromASTName("sp);/*9*/ ", 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void _testEnumeratorInFileScope() {fail("todo");}
|
|
||||||
public void _testEnumeratorInStructScope() {fail("todo");}
|
|
||||||
public void _testEnumeratorInUnionScope() {fail("todo");}
|
|
||||||
public void _testMemberAccess() {fail("todo");}
|
|
||||||
|
|
||||||
// // header file
|
// // header file
|
||||||
// struct myStruct {
|
// struct myStruct {
|
||||||
// int a;
|
// int a;
|
||||||
|
|
|
@ -648,7 +648,7 @@ public class CPPTemplates {
|
||||||
return null;
|
return null;
|
||||||
// mstodo- instantiate values correctly
|
// mstodo- instantiate values correctly
|
||||||
int parPos= Value.isTemplateParameter(value);
|
int parPos= Value.isTemplateParameter(value);
|
||||||
if (parPos > 0) {
|
if (parPos >= 0) {
|
||||||
ICPPTemplateArgument arg = tpMap.getArgument(parPos);
|
ICPPTemplateArgument arg = tpMap.getArgument(parPos);
|
||||||
if (arg != null) {
|
if (arg != null) {
|
||||||
IValue mappedValue = arg.getNonTypeValue();
|
IValue mappedValue = arg.getNonTypeValue();
|
||||||
|
|
Loading…
Add table
Reference in a new issue