[clang-tidy] Comparison between QualType objects from the same templated type returns false
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
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:
```cpp
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 :
```cpp
template
class TemplateClass {
T var;
};
class AnotherClass {
public:
void method(TemplateClass param);
};
void AnotherClass::method(TemplateClass param) {}
```
The same behavior happens if the return type is `TemplateClass` instead of `void`.
Is this the expected behavior for a templated type or should the comparison return true?
Contributor guide
Research direction
Start by reproducing the shown template declaration and definition, then inspect clang::TypeName::getFullyQualifiedType and QualType equality for the two parameter types. Determine whether the false comparison is expected for this templated type; completion requires a confirmed explanation and, if it is incorrect, a focused regression test or fix.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100