Skip to content

[ASTMatchers] Assertion with hasName matcher and inline namespaces #100973

@njames93

Description

@njames93

If an inline namespace has the same name as its direct parent, This can lead to assertions (or missed matches in release builds.
Take this example below with the matcher cxxRecordDecl(hasName("::a::A"))

namespace a {
inline namespace a {
class A;
}
}  // namespace a

The matcher should match as the inline namespace can safely be ignored, but currently it sees that it consume the inline namespace, Then when it tries to consume the enclosing namespace a it fails and reports no match.

https://godbolt.org/z/a3dzM8YnW

Metadata

Metadata

Assignees

Labels

clang:frontendLanguage frontend issues, e.g. anything involving "Sema"confirmedVerified by a second partycrash-on-valid

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions