<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 --- - Assertion failed with `decltype(auto)` and a function template with unknown return type"
   href="http://llvm.org/bugs/show_bug.cgi?id=20517">20517</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Assertion failed with `decltype(auto)` and a function template with unknown return type
          </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++1y
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>mimomorin@gmail.com
          </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>With this C++1y code: 

    template <typename T>
    auto f(int);

    int main(int argc, char* argv[])
    {
        decltype(auto) g = &f<int>;

        return 0;
    }

Clang crashes with the following message:

clang++ -std=c++1y ice_decltype_auto.cpp
ice_decltype_auto.cpp:6:24: error: reference to overloaded function could not
be
      resolved; did you mean to call it?
    decltype(auto) g = &f<int>;
                       ^~~~~~~
ice_decltype_auto.cpp:2:6: note: possible target for call
auto f(int);
     ^
Assertion failed: (!isNull() && "Cannot retrieve a NULL type pointer"),
function getCommonPtr, file
Clang/llvm/tools/clang/lib/AST/../../include/clang/AST/Type.h, line 546.
0  clang 0x0000000104aea492 llvm::sys::PrintStackTrace(__sFILE*) + 34
Stack dump:
0.    Program arguments: Clang/build/Release+Asserts/bin/clang -cc1 -triple
x86_64-apple-macosx10.7.0 -emit-obj -mrelax-all -disable-free -main-file-name
ice_decltype_auto.cpp -mrelocation-model pic -pic-level 2 -mdisable-fp-elim
-masm-verbose -munwind-tables -target-cpu core2 -target-linker-version 136
-dwarf-column-info -resource-dir
Clang/build/Release+Asserts/bin/../lib/clang/3.6.0 -std=c++1y
-fdeprecated-macro -fdebug-compilation-dir Codes -ferror-limit 19
-fmessage-length 80 -stack-protector 1 -mstackrealign -fblocks
-fobjc-runtime=macosx-10.7.0 -fencode-extended-block-signature -fcxx-exceptions
-fexceptions -fdiagnostics-show-option -fcolor-diagnostics -o
/var/folders/r5/h6yf9zwn68z4slg54d38smq80000gn/T/ice_decltype_auto-fa456e.o -x
c++ ice_decltype_auto.cpp 
1.    ice_decltype_auto.cpp:6:31: current parser token ';'
2.    ice_decltype_auto.cpp:5:1: parsing function body 'main'
3.    ice_decltype_auto.cpp:5:1: in compound statement ('{}')
clang: error: unable to execute command: Illegal instruction: 4
clang: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 3.6.0 (trunk 214512)
Target: x86_64-apple-darwin11.4.2
Thread model: posix
clang: note: diagnostic msg: PLEASE submit a bug report to
<a href="http://llvm.org/bugs/">http://llvm.org/bugs/</a> and include the crash backtrace, preprocessed source, and
associated run script.
clang: note: diagnostic msg:</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>