[LLVMbugs] [Bug 23906] New: clang compiles invalid multiple inheritance code

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sat Jun 20 15:53:43 PDT 2015


            Bug ID: 23906
           Summary: clang compiles invalid multiple inheritance code
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: ryan.burn at gmail.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

This fails to compile with gcc and EDG but compiles with clang:

#include <type_traits>                                                          
#include <utility>                                                              
#include <cassert>                                                              

template <class Tag, class Value>                                               
class Pack                                                                      
  Pack(const Value& value) : _value(value) {}                                   
  Value value() const { return _value; }                                        
  Value _value;                                                                 

template<class Tag, class Value>                                                
decltype(auto) unpack(Tag, Pack<Tag, Value>& pack) {                            
  return pack.value();                                                          

struct tag1 {};                                                                 
struct tag2 {};                                                                 

struct A3 : Pack<tag1, int>, Pack<tag2, double> {                               
  A3(int x, double y) : Pack<tag1, int>(x), Pack<tag2, double>(y) {}            

int main() {                                                                    
  A3 a3(1, 2);                                                                  
  assert(unpack(tag1(), a3) == 1);                                              
  assert(unpack(tag2(), a3) == 2);                                              

Per discussion on stackoverflow 


it looks like a compiler bug with clang

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/20150620/2a307edb/attachment.html>

More information about the llvm-bugs mailing list