[llvm-bugs] [Bug 41210] New: Wrong result of TypeName::getFullyQualifiedName(...) for function pointer types

via llvm-bugs llvm-bugs at lists.llvm.org
Sat Mar 23 08:22:08 PDT 2019


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: unassignedclangbugs at nondot.org
          Reporter: simon.schroeder at tu-dortmund.de
                CC: benny.kra at gmail.com, htmldeveloper at gmail.com,
                    llvm-bugs at lists.llvm.org, neeilans at live.com,
                    richard-llvm at metafoo.co.uk,
                    simon.schroeder at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190323/d15d12b3/attachment.html>


More information about the llvm-bugs mailing list