Skip to content

Don't simplify template for class names in declarations - #3505

Merged
danmar merged 2 commits into
cppcheck-opensource:mainfrom
KenPatrickLehrmann:typedef_classname
Nov 6, 2021
Merged

Don't simplify template for class names in declarations#3505
danmar merged 2 commits into
cppcheck-opensource:mainfrom
KenPatrickLehrmann:typedef_classname

Conversation

@KenPatrickLehrmann

Copy link
Copy Markdown
Contributor

Without the patch, the test would give:

Expected:
namespace foo { class Bar ; } class Baz ; class C : Baz { } ;

Actual:
namespace foo { class Bar ; } class Baz ; class foo :: Bar : Baz { } ;

Without the patch, the test would give:

```
Expected:
namespace foo { class Bar ; } class Baz ; class C : Baz { } ;

Actual:
namespace foo { class Bar ; } class Baz ; class foo :: Bar : Baz { } ;

```

@danmar danmar left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure what this should do.

As far as I see,

clang says:
1.cpp:8:7: error: definition of type 'C' conflicts with typedef of the same name

gcc says:
1.cpp:8:7: error: using typedef-name ‘C’ after ‘class’

@KenPatrickLehrmann

Copy link
Copy Markdown
Contributor Author

I am not sure what this should do.

As far as I see,

clang says: 1.cpp:8:7: error: definition of type 'C' conflicts with typedef of the same name

gcc says: 1.cpp:8:7: error: using typedef-name ‘C’ after ‘class’

Oh sorry, I probably got confused when I wrote the test case. I'll come up with a valid test case (I definitely saw this issue with some valid case, but there were more namespaces involved, I probably oversimplified).

@KenPatrickLehrmann

Copy link
Copy Markdown
Contributor Author

Done

@danmar danmar left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great! If CI is happy I think this is ok to merge.

@pfultz2

pfultz2 commented Nov 6, 2021

Copy link
Copy Markdown
Contributor

@danmar CI is happy.

@danmar
danmar merged commit f5f600b into cppcheck-opensource:main Nov 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants