-
Notifications
You must be signed in to change notification settings - Fork 1.5k
fix #13967: Template simplifier: put Tokens into proper scope #7634
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -319,6 +319,7 @@ class TestSymbolDatabase : public TestFixture { | |
TEST_CASE(namespaces2); | ||
TEST_CASE(namespaces3); // #3854 - unknown macro | ||
TEST_CASE(namespaces4); | ||
TEST_CASE(namespaces5); // #13967 | ||
TEST_CASE(needInitialization); | ||
|
||
TEST_CASE(tryCatch1); | ||
|
@@ -3209,6 +3210,18 @@ class TestSymbolDatabase : public TestFixture { | |
ASSERT_EQUALS(2U, fredAType->classDef->linenr()); | ||
} | ||
|
||
void namespaces5() { // #13967 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure if this is still about the TemplateSimplifier, but would a test there make sense? |
||
GET_SYMBOL_DB("namespace test {\n" | ||
" template <int S>\n" | ||
" struct Test { int x[S]; };\n" | ||
" const Test<64> test;\n" | ||
"}\n"); | ||
const Variable *x = db->getVariableFromVarId(2U); | ||
ASSERT_EQUALS("x", x->name()); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm I feel this test is a bit weird. Variable ids are just unique numbers. If the variable "x" would get varid 1002 in the future nothing is wrong about that but this test will fail. But on the other hand we have lots of similar tests already in testsymboldatabase so you just followed the common pattern! |
||
const Scope *scope = x->scope(); | ||
ASSERT_EQUALS("test", scope->nestedIn->className); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this test will not work well if |
||
} | ||
|
||
void needInitialization() { | ||
{ | ||
GET_SYMBOL_DB_DBG("template <typename T>\n" // #10259 | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this be a static function?