Skip to content

[clang-tidy] Comparison between QualType objects from the same templated type returns false #170141

@vitorsorpile

Description

@vitorsorpile

Hello, I'm developing a clang-tidy checker that compare the type aliases used in different declarations of the same entity, I'm using the code example below to obtain and compare the full type with namespaces, but removing local CVR-qualifiers, from QualType objects:

clang::TypeName::getFullyQualifiedType(Type1, ASTCtx, true) .withoutLocalFastQualifiers() == clang::TypeName::getFullyQualifiedType(Type2, ASTCtx, true) .withoutLocalFastQualifiers();

The comparison between the types of the parameters param from the following declaration/definition returns false :

template <typename T> class TemplateClass { T var; }; class AnotherClass { public: void method(TemplateClass<int> param); }; void AnotherClass::method(TemplateClass<int> param) {}

The same behavior happens if the return type is TemplateClass<int> instead of void.

Is this the expected behavior for a templated type or should the comparison return true?

Metadata

Metadata

Assignees

No one assigned

    Labels

    clang:frontendLanguage frontend issues, e.g. anything involving "Sema"questionA question, not bug report. Check out https://llvm.org/docs/GettingInvolved.html instead!

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions