[PATCH] Fix regression with noexcept

Aaron Ballman aaron at aaronballman.com
Fri Apr 10 10:56:38 PDT 2015


When working on diagnosing unevaluated expressions with side effects,
a regression crept in with seemingly valid code involving noexcept
expression that would receive an unresolved expression, such as:

template <class T> void f() {}
int v = noexcept(&f);

This code compiles without warning in gcc, and used to do the same in
Clang (and result in v being set to 1), but currently causes an
unreachable assertion. This is captured in PR22072.

This patch fixes the unreachable assertion. I believe it is reasonable
to expect unresolved expressions in HasSideEffects, and those
expressions would not have side effects. However, it may also be that
the noexcept code is ill-formed (see PR15842 for a similar situation,
which also currently asserts), and the correct fix is to diagnose the
code as a failed parameter to the noexcept expression.

~Aaron
-------------- next part --------------
A non-text attachment was scrubbed...
Name: noexcept.patch
Type: application/octet-stream
Size: 1530 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150410/85de3017/attachment.obj>


More information about the cfe-commits mailing list