Fix 9301: Syntax error when specializing template variable array (#3601)
This commit is contained in:
parent
8dcea26c10
commit
bc31419da0
|
@ -4530,7 +4530,8 @@ void Tokenizer::createLinks2()
|
||||||
}
|
}
|
||||||
// if > is followed by [ .. "new a<b>[" is expected
|
// if > is followed by [ .. "new a<b>[" is expected
|
||||||
// unless this is from varidiac expansion
|
// unless this is from varidiac expansion
|
||||||
if (token->strAt(1) == "[" && !Token::simpleMatch(token->tokAt(-1), "... >")) {
|
if (token->strAt(1) == "[" && !Token::simpleMatch(token->tokAt(-1), "... >") &&
|
||||||
|
!Token::Match(token->tokAt(1), "[ ]")) {
|
||||||
Token *prev = type.top()->previous();
|
Token *prev = type.top()->previous();
|
||||||
while (prev && Token::Match(prev->previous(), ":: %name%"))
|
while (prev && Token::Match(prev->previous(), ":: %name%"))
|
||||||
prev = prev->tokAt(-2);
|
prev = prev->tokAt(-2);
|
||||||
|
|
|
@ -6711,6 +6711,10 @@ private:
|
||||||
"constexpr void constexpr_for_fold_impl([[maybe_unused]] Functor&& f, std::index_sequence<Indices...>) noexcept {\n"
|
"constexpr void constexpr_for_fold_impl([[maybe_unused]] Functor&& f, std::index_sequence<Indices...>) noexcept {\n"
|
||||||
" (std::forward<Functor>(f).template operator() < First + Indices > (), ...);\n"
|
" (std::forward<Functor>(f).template operator() < First + Indices > (), ...);\n"
|
||||||
"}\n"));
|
"}\n"));
|
||||||
|
|
||||||
|
// #9301
|
||||||
|
ASSERT_NO_THROW(tokenizeAndStringify("template <typename> constexpr char x[] = \"\";\n"
|
||||||
|
"template <> constexpr char x<int>[] = \"\";\n"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void checkNamespaces() {
|
void checkNamespaces() {
|
||||||
|
|
Loading…
Reference in New Issue