Structural equivalence did not handle dependent template args properly
when the arg contained a DependentScopeDeclRefExpr.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
Hello Gabor,
I have a few questions inline.
clang/lib/AST/ASTStructuralEquivalence.cpp | ||
---|---|---|
124 ↗ | (On Diff #200996) | Should we check the equivalence of getCXXNameType() in such cases? |
127 ↗ | (On Diff #200996) | Should we check the equivalence of the whole Name1.getCXXDeductionGuideTemplate() (with the template arguments)? |
147 ↗ | (On Diff #200996) | llvm_unreachable()? |
163 ↗ | (On Diff #200996) | Should we compare TemplateArgs (getTemplateArgs) somehow? |
clang/lib/AST/ASTStructuralEquivalence.cpp | ||
---|---|---|
124 ↗ | (On Diff #200996) | Good catch, thanks! |
127 ↗ | (On Diff #200996) | Good catch, thanks! |
147 ↗ | (On Diff #200996) | Good catch, thanks! |
163 ↗ | (On Diff #200996) | No, that is not needed. Because getQualifier() returns with a NestedNameSpecifier and then in the appropriare overload of IsStructurallyEquivalent we will investigate further the type together with the template params: 213 case NestedNameSpecifier::TypeSpec: 214 case NestedNameSpecifier::TypeSpecWithTemplate: 215 return IsStructurallyEquivalent(Context, QualType(NNS1->getAsType(), 0), 216 QualType(NNS2->getAsType(), 0)); |
- Handle ImplicitCastExpr. In Clang7 in the last two test cases we did not have any ImplicitCastExpr in the AST. With never Clang we have, so we must handle the cast expr too.
cfe/trunk/lib/AST/ASTStructuralEquivalence.cpp | ||
---|---|---|
173 | Hi Gabor, |
cfe/trunk/lib/AST/ASTStructuralEquivalence.cpp | ||
---|---|---|
173 | Yes, there are implicit tests. template <typename T, typename enable_if<S1<T>::value>::type> had this AST before the rebase: TemplateSpecializationType 0xbd2b80 'enable_if<S1<T>::value>' dependent enable_if `-TemplateArgument expr `-DependentScopeDeclRefExpr 0xbd2b28 '<dependent type>' lvalue and this after rebase: TemplateSpecializationType 0xc0f0c0 'enable_if<S1<T>::value>' dependent enable_if `-TemplateArgument expr `-ImplicitCastExpr 0xc0f090 '_Bool' <Dependent> `-DependentScopeDeclRefExpr 0xc0f058 '<dependent type>' lvalue So, SameStructsInDependentScopeDeclRefExpr, DifferentStructsInDependentScopeDeclRefExpr and DifferentValueInDependentScopeDeclRefExpr do implicitly test this branch. These tests would not work without the branch for ImplicitCastExpr. |
Hi Gabor,
Is there any test for this branch?