<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 --- - Crash during compilation of union-like class with template method which has auto return value"
   href="http://llvm.org/bugs/show_bug.cgi?id=18628">18628</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Crash during compilation of union-like class with template method which has auto return value
          </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>-New Bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>christian@kellner.me
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>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=11948" name="attach_11948" title="Sample program that crashes clang">attachment 11948</a> <a href="attachment.cgi?id=11948&action=edit" title="Sample program that crashes clang">[details]</a></span>
Sample program that crashes clang

I reliably can get clang to crash when compiling a union-like class that has a
member function template where the return type is auto and inferred via
decltype. The crash seems only to happen when one of the members of the
anonymous union is accessed inside the decltype() operator, i.e. line 21 in the
attached sample program source. Changing the decltype parameter from 'val_bool'
to a integer literal or another regular member variable leads to no crash.

clang output:

% clang -v -o test -stdlib=libc++ -Wall -pedantic -std=c++11 ../main.cpp
Apple LLVM version 5.0 (clang-500.2.78) (based on LLVM 3.3svn)
Target: x86_64-apple-darwin13.0.0
Thread model: posix
0  clang                    0x00000001017babef main + 24873855
1  clang                    0x00000001017baf14 main + 24874660
2  libsystem_platform.dylib 0x00007fff8ec855aa _sigtramp + 26
3  libsystem_platform.dylib 0x0000000000000003 _sigtramp + 1899473523
4  clang                    0x00000001008bb551 main + 9147617
5  clang                    0x00000001008bb52a main + 9147578
6  clang                    0x00000001008b9941 main + 9140433
7  clang                    0x000000010078ee06 main + 7916950
8  clang                    0x000000010078df8b main + 7913243
9  clang                    0x000000010078c151 main + 7905505
10 clang                    0x000000010016e190 main + 1491232
11 clang                    0x00000001008a1067 main + 9039863
12 clang                    0x00000001002014fe main + 2094222
13 clang                    0x000000010020120b main + 2093467
14 clang                    0x00000001001f0c27 main + 2026423
15 clang                    0x00000001001f7e8a main + 2055706
16 clang                    0x00000001001ea479 main + 1999881
17 clang                    0x00000001001cc80b main + 1877915
18 clang                    0x000000010019edb3 main + 1690947
19 clang                    0x000000010019e258 main + 1688040
20 clang                    0x00000001000be5ac main + 771388
21 clang                    0x00000001000946c9 main + 599641
22 clang                    0x00000001000944ff main + 599183
23 clang                    0x00000001000943b4 main + 598852
24 clang                    0x000000010005ec02 main + 379794
25 clang                    0x000000010005ba14 main + 367012
26 clang                    0x000000010005a8c5 main + 362581
27 clang                    0x0000000100026c9d main + 150573
28 clang                    0x0000000100007cc0 main + 23632
29 libdyld.dylib            0x00007fff869d55fd start + 1
Stack dump:
0.    Program arguments:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
-cc1 -triple x86_64-apple-macosx10.9.0 -emit-obj -mrelax-all -disable-free
-disable-llvm-verifier -main-file-name main.cpp -mrelocation-model pic
-pic-level 2 -mdisable-fp-elim -masm-verbose -munwind-tables -target-cpu core2
-target-linker-version 224.1 -v -resource-dir
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/5.0
-stdlib=libc++ -Wall -pedantic -std=c++11 -fdeprecated-macro
-fdebug-compilation-dir /Users/gicmo/Coding/G-Node/nix/build -ferror-limit 19
-fmessage-length 202 -stack-protector 1 -mstackrealign -fblocks
-fobjc-runtime=macosx-10.9.0 -fobjc-dispatch-method=mixed
-fobjc-default-synthesize-properties -fencode-extended-block-signature
-fcxx-exceptions -fexceptions -fdiagnostics-show-option -fcolor-diagnostics -o
/var/folders/92/wg8lbvx97jg53h4pmbt6kby40000gn/T/main-Ycs5pz.o -x c++
../main.cpp
1.    <eof> parser at end of file
2.    ../main.cpp:31:1: LLVM IR generation of declaration 'main'
3.    ../main.cpp:31:1: Generating code for declaration 'main'
4.    ../main.cpp:19:10: Mangling declaration 'dummy::visit'
clang: error: unable to execute command: Segmentation fault: 11
clang: error: clang frontend command failed due to signal (use -v to see
invocation)
Apple LLVM version 5.0 (clang-500.2.78) (based on LLVM 3.3svn)
Target: x86_64-apple-darwin13.0.0</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>