[Bug c++/67371] New: Never executed "throw" in constexpr function fails to compile
ldionne.2 at gmail dot com
gcc-bugzilla@gcc.gnu.org
Thu Aug 27 13:26:00 GMT 2015
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67371
Bug ID: 67371
Summary: Never executed "throw" in constexpr function fails to
compile
Product: gcc
Version: 6.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: ldionne.2 at gmail dot com
Target Milestone: ---
The following code fails to compile on GCC trunk:
constexpr void f() {
if (false)
throw;
}
The error is:
[snip]: In function 'constexpr void f()':
[snip]: error: expression '<throw-expression>' is not a constant-expression
}
^
The code should compile because the throw expression is never executed inside a
constexpr context. Clang indeed compiles this just fine.
Live example: http://melpon.org/wandbox/permlink/V0g96xpWdO2eWGNx
More information about the Gcc-bugs
mailing list