Bug ID: 41210
           Summary: Wrong result of TypeName::getFullyQualifiedName(...)
                    for function pointer types
           Product: clang
           Version: 8.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs

Similiar to bug 40732, there is another problem with
TypeName::getFullyQualifiedName. The problem is, that it does not fully qualify
arguments and result types of function pointers. With elaborated argument or
result types, not only the global namespace specifier is missing, but also
nested namespace specifiers.

Consider the following code:
  namespace N {
    class C { 
      class C2 { };
    void foo() {
      C::C2& (*bar)(C* a, C::C2& b);
  int main() {

getFullyQualifiedName's result for bar's type (independent of
WithGlobalNsPrefix's value) is "C::C2 &(*)(N::C *, C::C2 &)". The type string
of the first argument's type is missing the global namespace specifier. The
type string for the second argument's type as well as the type string for the
result's type lack the nested name specifier for namespace "N" and the global
namespace. The expected result with WithGlobalNsPrefix set to true would be:
::N::C::C2 &(*)(::N::C *, ::N::C::C2 &)
The expected result with WithGlobalNsPrefix set to false would be:
N::C::C2 &(*)(N::C *, N::C::C2 &)

Therefore, getFullyQualifiedName's result with both WithGlobalNsPrefix set to
true or false is not correct.

You are receiving this mail because:
You are on the CC list for the bug.
llvm-bugs mailing list

Reply via email to