https://bugs.llvm.org/show_bug.cgi?id=41210

            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
          Assignee: unassignedclangb...@nondot.org
          Reporter: simon.schroe...@tu-dortmund.de
                CC: benny....@gmail.com, htmldevelo...@gmail.com,
                    llvm-bugs@lists.llvm.org, neeil...@live.com,
                    richard-l...@metafoo.co.uk,
                    simon.schroe...@tu-dortmund.de

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.

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

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
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to