[llvm-bugs] [Bug 33281] New: Clang crash on invalid c++11 code (UNREACHABLE executed at clang/lib/AST/StmtProfile.cpp:1196!)

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Jun 2 09:49:50 PDT 2017


https://bugs.llvm.org/show_bug.cgi?id=33281

            Bug ID: 33281
           Summary: Clang crash on invalid c++11 code (UNREACHABLE
                    executed at clang/lib/AST/StmtProfile.cpp:1196!)
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++11
          Assignee: unassignedclangbugs at nondot.org
          Reporter: andrea.dibiagio at gmail.com
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org

This may be a duplicate of bug 28793.
However, this bug can also be reproduced with -std=c++11.

I am using:
clang version 5.0.0 (trunk 304555)
Target: x86_64-unknown-linux-gnu

--

Here is the reproducible:

// ============================================================================
template <typename _Ty> struct add_rvalue_reference {
  typedef _Ty &&type;
};

template <typename _Ty> typename add_rvalue_reference<_Ty>::type declval();

template <typename _Fty> struct _Result_of {
  static auto _Fn() -> decltype(declval<_Fty>()());
};

template <typename T> struct Future {};

template <typename Function>
Future<typename _Result_of<Function>::type> Firstly(Function) {
}

void Join() {
  Firstly([] { return Future<void>::foobar; });
}
// ============================================================================

--

>clang test.cpp -std=gnu++11 -c

test.cpp:18:37: error: no member named 'foobar' in 'Future<void>'
  Firstly([] { return Future<void>::foobar; });
                      ~~~~~~~~~~~~~~^
Invalid operator call kind
UNREACHABLE executed at
/home/andrea/cllvm/llvm/tools/clang/lib/AST/StmtProfile.cpp:1196!

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20170602/fdfa67a8/attachment.html>


More information about the llvm-bugs mailing list