Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions lib/tokenize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2998,6 +2998,9 @@ bool Tokenizer::simplifyUsing()
if (!usingEnd)
continue;

for (Token *typeTok = start; typeTok != usingEnd; typeTok = typeTok->next())
typeTok->isSimplifiedTypedef(true);

// Move struct defined in using out of using.
// using T = struct t { }; => struct t { }; using T = struct t;
// fixme: this doesn't handle attributes
Expand Down
6 changes: 6 additions & 0 deletions test/testother.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4763,6 +4763,12 @@ class TestOther : public TestFixture {
" return [](int* p) { return *p; }(&i);\n"
"}\n");
ASSERT_EQUALS("[test.cpp:3:20]: (style) Parameter 'p' can be declared as pointer to const [constParameterPointer]\n", errout_str());

check("using IntPtr = int *;\n"
"int* foo(IntPtr bar) {\n"
" return bar = 0;\n"
"}\n");
ASSERT_EQUALS("", errout_str());
}

void constArray() {
Expand Down
Loading