Skip to content

Commit 30cdc63

Browse files
authored
Fix #14539: false positive: constParameterPointer with type alias (danmar#8310)
1 parent 085cc68 commit 30cdc63

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

lib/tokenize.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3013,6 +3013,9 @@ bool Tokenizer::simplifyUsing()
30133013
if (!usingEnd)
30143014
continue;
30153015

3016+
for (Token *typeTok = start; typeTok != usingEnd; typeTok = typeTok->next())
3017+
typeTok->isSimplifiedTypedef(true);
3018+
30163019
// Move struct defined in using out of using.
30173020
// using T = struct t { }; => struct t { }; using T = struct t;
30183021
// fixme: this doesn't handle attributes

test/testother.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4789,6 +4789,12 @@ class TestOther : public TestFixture {
47894789
" return h(s ? s->gnc() : 1);\n"
47904790
"}\n");
47914791
ASSERT_EQUALS("[test.cpp:5:11]: (style) Parameter 's' can be declared as pointer to const [constParameterPointer]\n", errout_str());
4792+
4793+
check("using IntPtr = int *;\n"
4794+
"int* foo(IntPtr bar) {\n"
4795+
" return bar = 0;\n"
4796+
"}\n");
4797+
ASSERT_EQUALS("", errout_str());
47924798
}
47934799

47944800
void constArray() {

0 commit comments

Comments
 (0)