[llvm-bugs] [Bug 47582] New: Crash on compiling invalid requires expression

via llvm-bugs llvm-bugs at lists.llvm.org
Sat Sep 19 01:53:35 PDT 2020


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

            Bug ID: 47582
           Summary: Crash on compiling invalid requires expression
           Product: clang
           Version: trunk
          Hardware: Macintosh
                OS: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++2a
          Assignee: unassignedclangbugs at nondot.org
          Reporter: marian.darius98 at gmail.com
                CC: blitzrakete at gmail.com, erik.pilkington at gmail.com,
                    llvm-bugs at lists.llvm.org, richard-llvm at metafoo.co.uk

Created attachment 23984
  --> https://bugs.llvm.org/attachment.cgi?id=23984&action=edit
Files requested by the compiler in the crash message.

While writing an experimental implementation of std::is_polymorphic using a
requires expression, I made a small mistake in the program. I was expecting a
compile error, but Clang crashed instead (with an assertion failure):

template<class T>
inline constexpr bool is_polymorphic = requires {
  typename dynamic_cast<const volatile void*>(declval<T*>());
};

The expected output is a compile error (I strongly believe), the code is an
invalid usage of the requires { typename ... } clause.

I attached a bundle with all the files required by the crash. Since it was
fully reproducible, I minimized the example as much as I could.
"clang-crash.cpp" is the original source code, "cli-output.txt" is the console
output for running the command, and the other attachments are files requested
in the output of the compiler.

-- 
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/20200919/e634da19/attachment.html>


More information about the llvm-bugs mailing list