llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
29.24k stars 12.07k forks source link

createNestedNameSpecifierForScopeOf does not work for Dependent name types #39985

Open MaxSagebaum opened 5 years ago

MaxSagebaum commented 5 years ago
Bugzilla Link 40639
Version unspecified
OS Linux
Attachments Tooling implementation that shows the bug, with patch compile script and example.

Extended Description

A function call to getFullyQualifiedType with a dependent name type is not resolved correctly.

For the definition of: namespace name { template struct AB { struct Test { using Type = T; }; AB() {}

void func(Test a, typename Test::Type b) {}

};
}

The arguments of func are resolved to: Parameter: a Full qual type: name::AB::Test Parameter: b Full qual type: typename Test::Type

I tried to find the error and could get a partial patch: --- a/QualTypeNames.cpp 2019-02-06 14:50:37.169581290 +0100 +++ b/QualTypeNames.cpp 2019-02-06 14:53:08.114611002 +0100 @@ -326,6 +326,8 @@ Decl = TagDeclType->getDecl(); } else if (const auto *TST = dyn_cast(TypePtr)) { Decl = TST->getTemplateName().getAsTemplateDecl();

With this Patch the result is now: Parameter: a Full qual type: name::AB::Test Parameter: b Full qual type: name::AB::typename Test::Type

I could not get how to convert the DependentNameType to a regular type.

The expected result would be: Parameter: a Full qual type: name::AB::Test Parameter: b Full qual type: typename name::AB::Test::Type

Find attached the compile script, the example file, the patch and the tooling implementation which shows the bug.

MaxSagebaum commented 3 years ago

ping