[PATCH] Guard the noexcept with __cplusplus version.

Richard Smith richard at metafoo.co.uk
Mon May 5 11:46:37 PDT 2014


On Mon, May 5, 2014 at 10:55 AM, Joerg Sonnenberger <joerg at britannica.bec.de
> wrote:

> On Mon, May 05, 2014 at 05:39:12PM +0000, Logan Chien wrote:
> > To allow the compilation with gcc, we can't use the
> > __has_feature(noexcept) to detect the existence of noexcept
> > keyword.  We should use __cplusplus >= 201103L instead.
>
> I don't think this is correct. Shouldn't it use noexcept if *either* the
> feature exists OR the language is C++11?


The __cplusplus check is correct here: what we're really testing is whether
we have the C++11 rule that destructors are implicitly noexcept or not (the
check that 'noexcept' works is incidental). In any case,
__has_feature(noexcept) will only be true if we're in C++11-or-later mode,
because __has_feature looks for features that are part of the
currently-enabled language mode.

=> Patch LGTM.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140505/b12602ab/attachment.html>


More information about the cfe-commits mailing list