<html>
    <head>
      <base href="http://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 crashes on using declaration with union member"
   href="http://llvm.org/bugs/show_bug.cgi?id=16630">16630</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>clang crashes on using declaration with union member
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>3.3
          </td>
        </tr>

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

        <tr>
          <th>OS</th>
          <td>MacOS X
          </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>d.leinhaeuser@fishlabs.net
          </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>Created <span class=""><a href="attachment.cgi?id=10882" name="attach_10882" title="Full output of the clang++ invocation.">attachment 10882</a> <a href="attachment.cgi?id=10882&action=edit" title="Full output of the clang++ invocation.">[details]</a></span>
Full output of the clang++ invocation.

using declarations that refer to union members seem to crash clang++.

Steps to reproduce:

Compile the following program (simply invoking 'clang++ [FILENAME]'):

struct A { union { int x; }; };
struct B : private A { using A::x; } b;
int main (int, char**) { b.x = 0; return 0; }

Actual result:
clang++ generates an the following (incorrect IMHO) error message and then
exits with a segmentation fault (full output is attached):

testUsing.cc:4:26: error: cannot cast 'struct B' to its private base class 'A'
int main (int, char**) { b.x = 0; return 0; }
                         ^
testUsing.cc:2:12: note: declared private here
struct B : private A { using A::x; } b;
           ^~~~~~~~~

Expected result: clang++ generates a program that simply exits with code 0.
(Tested with "i686-apple-darwin11-llvm-g++-4.2 (GCC) 4.2.1 (Based on Apple Inc.
build 5658) (LLVM build 2336.11.00)")

Version & Platform:
clang version 3.3 (tags/RELEASE_33/final) on Mac OS X 10.8.4

Additional Information:

Crash log section (as per bug writing guidlines):
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   clang                             0x0000000100119f8c 0x100000000 + 1154956
1   clang                             0x000000010081970e 0x100000000 + 8492814
2   clang                             0x0000000100119772 0x100000000 + 1152882
3   clang                             0x00000001001126b9 0x100000000 + 1124025
4   clang                             0x00000001000c3382 0x100000000 + 799618
5   clang                             0x00000001000c2202 0x100000000 + 795138
6   clang                             0x00000001000be83d 0x100000000 + 780349
7   clang                             0x00000001000c1e4a 0x100000000 + 794186
8   clang                             0x00000001000be83d 0x100000000 + 780349
9   clang                             0x00000001000c510e 0x100000000 + 807182
10  clang                             0x000000010018349c 0x100000000 + 1586332
11  clang                             0x0000000100109aeb 0x100000000 + 1088235
12  clang                             0x0000000100108078 0x100000000 + 1081464
13  clang                             0x00000001001075df 0x100000000 + 1078751
14  clang                             0x0000000100104c9d 0x100000000 + 1068189
15  clang                             0x0000000100090999 0x100000000 + 592281
16  clang                             0x000000010007d01d 0x100000000 + 512029
17  clang                             0x000000010007c99e 0x100000000 + 510366
18  clang                             0x000000010007c261 0x100000000 + 508513
19  clang                             0x000000010007a62e 0x100000000 + 501294
20  clang                             0x000000010005a5b6 0x100000000 + 370102
21  clang                             0x00000001000566c0 0x100000000 + 353984
22  clang                             0x000000010005531c 0x100000000 + 348956
23  clang                             0x000000010002608d 0x100000000 + 155789
24  clang                             0x0000000100009aa5 0x100000000 + 39589
25  clang                             0x0000000100002f8b main + 2411
26  clang                             0x0000000100002524 0x100000000 + 9508</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>