cppcheck produces the following output for this nested.cc
Checking nested.cc ...
nested.cc:6:1: error: The one definition rule is violated, different classes/structs have the same name 'Inner' [ctuOneDefinitionRuleViolation]
class OuterAbc::Inner { };
^
nested.cc:13:1: note: The one definition rule is violated, different classes/structs have the same name 'Inner'
class OuterXyz::Inner { };
^
nested.cc:6:1: note: The one definition rule is violated, different classes/structs have the same name 'Inner'
class OuterAbc::Inner { };
^
The name of the nested class exists in the scope of the enclosing class
It seems like this nested.cc is defining two different classes 'OuterAbc::Inner' and 'OuterXyz::Inner'. But cppcheck is complaining about multiple definitions of plain 'Inner' ?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
File nested.cc contains
cppcheck produces the following output for this nested.cc
According to https://en.cppreference.com/w/cpp/language/nested_types
It seems like this nested.cc is defining two different classes 'OuterAbc::Inner' and 'OuterXyz::Inner'. But cppcheck is complaining about multiple definitions of plain 'Inner' ?
Which version do you use? I cannot reproduce this with head.
When I use latest released 2.7 no error. Turns out I was using 2.4.1. I should have checked version to be sure latest, doh.
Thanks.