mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Bug 401024 - Error involving variadic templates
Change-Id: Ic5e0b3176e87e6dcecfb528367ce5f8eea4760c1 Reviewed-on: https://git.eclipse.org/r/10426 Reviewed-by: Sergey Prigogin <eclipse.sprigogin@gmail.com> IP-Clean: Sergey Prigogin <eclipse.sprigogin@gmail.com> Tested-by: Sergey Prigogin <eclipse.sprigogin@gmail.com>
This commit is contained in:
parent
c48e321ea3
commit
81885d232f
2 changed files with 46 additions and 5 deletions
|
@ -4509,25 +4509,25 @@ public class AST2TemplateTests extends AST2TestBase {
|
|||
parseAndCheckBindings(code);
|
||||
BindingAssertionHelper bh= new BindingAssertionHelper(code, CPP);
|
||||
ICPPFunctionTemplate f= bh.assertNonProblem("f1", 2);
|
||||
assertEquals("void (int (*)(#0 ...))", ASTTypeUtil.getType(f.getType(), true));
|
||||
assertEquals("void (int (*)(#0(...) ...))", ASTTypeUtil.getType(f.getType(), true));
|
||||
assertFalse(f.getParameters()[0].isParameterPack());
|
||||
f= bh.assertNonProblem("f2", 2);
|
||||
assertEquals("void (int (* ...)(#0, int))", ASTTypeUtil.getType(f.getType(), true));
|
||||
assertEquals("void (int (* ...)(#0(...), int))", ASTTypeUtil.getType(f.getType(), true));
|
||||
assertTrue(f.getParameters()[0].isParameterPack());
|
||||
f= bh.assertNonProblem("f3", 2);
|
||||
assertEquals("void (#0 (* ...)())", ASTTypeUtil.getType(f.getType(), true));
|
||||
assertEquals("void (#0(...) (* ...)())", ASTTypeUtil.getType(f.getType(), true));
|
||||
assertTrue(f.getParameters()[0].isParameterPack());
|
||||
f= bh.assertNonProblem("f4", 2);
|
||||
assertEquals("void (int (& ...)[3 *0 0])", ASTTypeUtil.getType(f.getType(), true));
|
||||
assertTrue(f.getParameters()[0].isParameterPack());
|
||||
f= bh.assertNonProblem("f5", 2);
|
||||
assertEquals("void (#0 ...)", ASTTypeUtil.getType(f.getType(), true));
|
||||
assertEquals("void (#0(...) ...)", ASTTypeUtil.getType(f.getType(), true));
|
||||
assertTrue(f.getParameters()[0].isParameterPack());
|
||||
f= bh.assertNonProblem("f6", 2);
|
||||
assertEquals("void (#0, ...)", ASTTypeUtil.getType(f.getType(), true));
|
||||
assertFalse(f.getParameters()[0].isParameterPack());
|
||||
f= bh.assertNonProblem("f7", 2);
|
||||
assertEquals("#0 ...", ASTTypeUtil.getType(f.getExceptionSpecification()[0], true));
|
||||
assertEquals("#0(...) ...", ASTTypeUtil.getType(f.getExceptionSpecification()[0], true));
|
||||
}
|
||||
|
||||
// template<typename... Pack> class C1 {};
|
||||
|
@ -7165,4 +7165,43 @@ public class AST2TemplateTests extends AST2TestBase {
|
|||
public void testDependentExpressionInvolvingFieldInNestedClass_399362() throws Exception {
|
||||
parseAndCheckBindings();
|
||||
}
|
||||
|
||||
// template <typename _Tp>
|
||||
// struct remove_reference {
|
||||
// typedef _Tp type;
|
||||
// };
|
||||
// template <typename>
|
||||
// struct A {};
|
||||
// template <typename From, typename To>
|
||||
// struct waldo {
|
||||
// typedef typename remove_reference<From>::type src_t;
|
||||
// typedef A<src_t> type;
|
||||
// };
|
||||
// template <bool First>
|
||||
// struct ice_or {
|
||||
// static const bool value = First;
|
||||
// };
|
||||
// template <typename T>
|
||||
// struct is_waldo {
|
||||
// static const bool value = false;
|
||||
// };
|
||||
// template <typename... Args>
|
||||
// struct contains_waldo {
|
||||
// static const bool value = ice_or<is_waldo<typename remove_reference<Args>::type>::value...>::value;
|
||||
// };
|
||||
// template <bool>
|
||||
// struct S {};
|
||||
// struct Cat {
|
||||
// void meow();
|
||||
// };
|
||||
// template <>
|
||||
// struct S<false> {
|
||||
// typedef Cat type;
|
||||
// };
|
||||
// int main() {
|
||||
// S<contains_waldo<int>::value>::type t;
|
||||
// }
|
||||
public void testVariadicTemplates_401024() throws Exception {
|
||||
parseAndCheckBindings();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -424,6 +424,8 @@ public class ASTTypeUtil {
|
|||
if (normalize) {
|
||||
result.append('#');
|
||||
result.append(Integer.toString(type.getParameterID(), 16));
|
||||
if (type.isParameterPack())
|
||||
result.append("(...)"); //$NON-NLS-1$
|
||||
} else {
|
||||
result.append(type.getName());
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue