Fix 10336: AST cyclic dependency on valid C++ code (#3331)
This commit is contained in:
parent
7e2ba803f4
commit
2300a773e1
|
@ -19,6 +19,7 @@
|
|||
//---------------------------------------------------------------------------
|
||||
#include "tokenlist.h"
|
||||
|
||||
#include "astutils.h"
|
||||
#include "errorlogger.h"
|
||||
#include "library.h"
|
||||
#include "path.h"
|
||||
|
@ -1351,7 +1352,7 @@ static Token * createAstAtToken(Token *tok, bool cpp);
|
|||
// Compile inner expressions inside inner ({..}) and lambda bodies
|
||||
static void createAstAtTokenInner(Token * const tok1, const Token *endToken, bool cpp)
|
||||
{
|
||||
for (Token *tok = tok1; tok && tok != endToken; tok = tok ? tok->next() : nullptr) {
|
||||
for (Token* tok = tok1; precedes(tok, endToken); tok = tok ? tok->next() : nullptr) {
|
||||
if (tok->str() == "{" && !iscpp11init(tok)) {
|
||||
const Token * const endToken2 = tok->link();
|
||||
bool hasAst = false;
|
||||
|
|
|
@ -6620,6 +6620,19 @@ private:
|
|||
"}\n"));
|
||||
|
||||
ASSERT_NO_THROW(tokenizeAndStringify("a<b?0:1>()==3;"));
|
||||
|
||||
// #10336
|
||||
ASSERT_NO_THROW(tokenizeAndStringify("struct a {\n"
|
||||
" template <class b> a(b);\n"
|
||||
"};\n"
|
||||
"struct c;\n"
|
||||
"void fn1(int, a);\n"
|
||||
"void f() { fn1(0, {a{0}}); }\n"
|
||||
"template <class> std::vector<c> g() {\n"
|
||||
" int d;\n"
|
||||
" for (size_t e = 0; e < d; e++)\n"
|
||||
" ;\n"
|
||||
"}\n"));
|
||||
}
|
||||
|
||||
void checkNamespaces() {
|
||||
|
|
Loading…
Reference in New Issue