<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW " title="NEW --- - clang compiles invalid multiple inheritance code" href="https://urldefense.proofpoint.com/v2/url?u=https-3A__llvm.org_bugs_show-5Fbug.cgi-3Fid-3D23906&d=AwMBaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=pF93YEPyB-J_PERP4DUZOJDzFVX5ZQ57vQk33wu0vio&m=Jh9H5txiryxDxQg1H1CO8uZFM2_K4KAuaVcSudZTEfY&s=LTQ6vE5ijDG3mIBfk46prkvt_7myyCRXshNQ8Zb_frc&e=">23906</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>clang compiles invalid multiple inheritance code
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>C++
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>ryan.burn@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>dgregor@apple.com, llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>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                                                                      
{                                                                               
 public:                                                                        
  Pack(const Value& value) : _value(value) {}                                   
  Value value() const { return _value; }                                        
private:                                                                        
  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 

<a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__stackoverflow.com_questions_30814981_will-2Dthis-2Dtemplate-2Dfunction-2Dcorrectly-2Dmatch-2Da-2Dclass-2Dwith-2Dmultiple-2Dbases&d=AwMBaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=pF93YEPyB-J_PERP4DUZOJDzFVX5ZQ57vQk33wu0vio&m=Jh9H5txiryxDxQg1H1CO8uZFM2_K4KAuaVcSudZTEfY&s=M9jWNjpch_hA4S7q5XmeyDzmfSNWl3wy-b8VC1WkAKM&e=">http://stackoverflow.com/questions/30814981/will-this-template-function-correctly-match-a-class-with-multiple-bases</a>

it looks like a compiler bug with clang</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>