[llvm-bugs] [Bug 25288] New: bug with variadic class friend functions

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Oct 22 12:44:17 PDT 2015


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

            Bug ID: 25288
           Summary: bug with variadic class friend functions
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++14
          Assignee: unassignedclangbugs at nondot.org
          Reporter: ryan.burn at gmail.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

The below code compiles fine with gcc and EDG, but gives this error with clang:

rnburn at localhost ~/test/friend_auto $ c++14 t.cpp 
t.cpp:18:3: error: call to 'f' is ambiguous
  f(a);
  ^
t.cpp:6:15: note: candidate function [with Qx = <int, double>]
  friend auto f(A<Qx...> a);
              ^
t.cpp:12:6: note: candidate function [with Qx = <int, double>]
auto f(A<Qx...> a) {
     ^
1 error generated.

///////////////////////////////////////////////////////////////
template<class... Tx>                                                           
class A {                                                                       
 public:                                                                        
  A(int xx) : x(xx) {}                                                          
  template<class... Qx>                                                         
  friend auto f(A<Qx...> a);                                                    
 private:                                                                       
  int x;                                                                        
};                                                                              

template<class... Qx>                                                           
auto f(A<Qx...> a) {                                                            
  return a.x;                                                                   
}                                                                               

int main() {                                                                    
  A<int, double> a(22);                                                         
  f(a);                                                                         
  return 0;                                                                     
}
///////////////////////////////////////////////////////////////

-- 
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/20151022/b7517b6c/attachment.html>


More information about the llvm-bugs mailing list