[LLVMbugs] [Bug 20001] New: should offer to add missing namespace

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Jun 10 18:06:25 PDT 2014


http://llvm.org/bugs/show_bug.cgi?id=20001

            Bug ID: 20001
           Summary: should offer to add missing namespace
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: nlewycky at google.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Testcase:

struct X {
  void test() {
    static_cast<void(X::*)(int)>(&memfn);
  }
  template<typename T> void memfn(T);
};

We currently emit:

abcdefg-x.cc:3:5: error: address of overloaded function 'memfn' cannot be
      static_cast to type 'void (X::*)(int)'
    static_cast<void(X::*)(int)>(&memfn);
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
abcdefg-x.cc:5:29: note: candidate function
  template<typename T> void memfn(T);
                            ^
1 error generated.

When memfn is not a template, we get:

abcdefg-x.cc:3:34: error: must explicitly qualify name of member function when
      taking its address
    static_cast<void(X::*)(int)>(&memfn);
                                 ^~~~~~
                                  X::

which is much better.

-- 
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/20140611/b46b3f78/attachment.html>


More information about the llvm-bugs mailing list