<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </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 - Miscompiled direct base initialization in inherited constructor from virtual base of same type"
   href="https://bugs.llvm.org/show_bug.cgi?id=34426">34426</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Miscompiled direct base initialization in inherited constructor from virtual base of same type
          </td>
        </tr>

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

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

        <tr>
          <th>Hardware</th>
          <td>All
          </td>
        </tr>

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

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

        <tr>
          <th>Keywords</th>
          <td>miscompilation
          </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>hstong@ca.ibm.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>dgregor@apple.com, llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>When a constructor is inherited from a virtual base and the class from which
said constructor is inherited is also a direct base of the complete object
being constructed, the initialization of the direct base is supposed to be a
default initialization, but Clang seems to treat it like the virtual base.

### SOURCE (<stdin>):
extern "C" int printf(const char *, ...);

struct A { A(int); A() = default; };
A::A(int x) { printf("%s: %d\n", __PRETTY_FUNCTION__, x); }

struct B : virtual A { using A::A; };
struct C : B, A { using B::B; };

int main(void) { C c(42); }


### COMPILER INVOCATION:
clang++ -Wall -Wextra -Wno-inaccessible-base -xc++ -std=c++1z -o a.out -


### COMPILER OUTPUT:
(Clean compile)


### ACTUAL RUN OUTPUT (./a.out):
A::A(int): 42
A::A(int): 42


### EXPECTED RUN OUTPUT:
A::A(int): 42


### COMPILER VERSION INFO (clang++ -v):
clang version 6.0.0 (<a href="https://github.com/llvm-mirror/clang.git">https://github.com/llvm-mirror/clang.git</a>
9b13d907c509a53fd938dcc777bb7dd097cea4c0)
(<a href="https://github.com/llvm-mirror/llvm.git">https://github.com/llvm-mirror/llvm.git</a>
707fb1cf0ca99d98c59f1ae87b7e0ff9b2dd0c8b)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /opt/wandbox/clang-head/bin
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.4.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6.0.0
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.4.0
Candidate multilib: .;@m64
Selected multilib: .;@m64</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>