[llvm-bugs] [Bug 28419] New: clang rejects valid C++ code with pointer to overloaded member function as rvalue

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Jul 5 00:25:19 PDT 2016


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

            Bug ID: 28419
           Summary: clang rejects valid C++ code with pointer to
                    overloaded member function as rvalue
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: su at cs.ucdavis.edu
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org
    Classification: Unclassified

The current clang trunk rejects the following valid C++ test case (which is
accepted by GCC and MSVC) on x86_64-linux-gnu in both 32-bit and 64-bit modes. 

It is accepted by 3.3, and rejected by 3.4 and later. 


$ clang++ -v
clang version 3.9.0 (trunk 274483)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/clang-trunk/bin
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.4
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.4.7
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.6
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.6.4
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.7
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.7.3
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8.4
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9.3
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.3.0
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Candidate multilib: x32;@mx32
Selected multilib: .;@m64
$ 
$ clang++-3.3 -c small.cpp
$ g++-6.1 -c small.cpp
$ 
$ clang++ -c small.cpp
small.cpp:8:19: error: cannot create a non-constant pointer to member function
void (*p) (int) = a.f; 
                  ^~~
1 error generated.
$ 


----------------------------------


struct A
{
  static void f (int) {} 
  static void f () {};
};

A a; 
void (*p) (int) = a.f;

-- 
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/20160705/8e318e66/attachment.html>


More information about the llvm-bugs mailing list