Skip to content

Commit fcb330f

Browse files
Fix #13929 FP internalAstError with using declaration and template aliased type (danmar#7596)
Co-authored-by: chrchr-github <[email protected]>
1 parent e30978d commit fcb330f

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

lib/templatesimplifier.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2099,7 +2099,7 @@ void TemplateSimplifier::expandTemplate(
20992099
Token * const beforeTypeToken = mTokenList.back();
21002100
bool pointerType = false;
21012101
const bool isVariadicTemplateArg = templateDeclaration.isVariadic() && itype + 1 == typeParametersInDeclaration.size();
2102-
if (isVariadicTemplateArg && mTypesUsedInTemplateInstantiation.size() > 1 && !Token::simpleMatch(tok3->next(), "..."))
2102+
if (isVariadicTemplateArg && mTypesUsedInTemplateInstantiation.size() > 1 && !Token::Match(tok3->next(), "...|<"))
21032103
continue;
21042104
if (isVariadicTemplateArg && Token::Match(tok3, "%name% ... %name%"))
21052105
tok3 = tok3->tokAt(2);

test/testsimplifytemplate.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6344,6 +6344,20 @@ class TestSimplifyTemplate : public TestFixture {
63446344
"} "
63456345
"} ;";
63466346
ASSERT_EQUALS(expected, tok(code));
6347+
6348+
const char code2[] = "template <typename T>\n" // #13929
6349+
"struct S {};\n"
6350+
"template <typename T, template<typename...> typename C = S>\n"
6351+
"struct A {\n"
6352+
" using x = C<T>;\n"
6353+
"};\n"
6354+
"A<int> a;\n";
6355+
const char expected2[] = "template < typename T > "
6356+
"struct S { } ; "
6357+
"struct A<int,S> ; "
6358+
"A<int,S> a ; "
6359+
"struct A<int,S> { } ;";
6360+
ASSERT_EQUALS(expected2, tok(code2));
63476361
}
63486362

63496363
void template_variable_1() {

0 commit comments

Comments
 (0)