[MacPorts] #57578: __has_feature(cxx_exceptions) returns true but fails to compile std::uncaught_exceptions()
MacPorts
noreply at macports.org
Mon Nov 12 07:39:28 UTC 2018
#57578: __has_feature(cxx_exceptions) returns true but fails to compile
std::uncaught_exceptions()
------------------------+----------------------
Reporter: noloader | Owner: jeremyhu
Type: defect | Status: assigned
Priority: Normal | Milestone:
Component: ports | Version:
Resolution: | Keywords:
Port: clang-6.0 |
------------------------+----------------------
Comment (by noloader):
Replying to [comment:6 jmroot]:
> Replying to [ticket:57578 noloader]:
> > According to the LLVM 3.6 release notes
(https://releases.llvm.org/3.6.0/tools/clang/docs/ReleaseNotes.html#the-
exceptions-macro), I believe I am using the correct feature test:
> >
> > To reliably test if C++ exceptions are enabled,
> > use `__EXCEPTIONS && __has_feature(cxx_exceptions)`,
> > else things won’t work in all versions of Clang in
> > Objective-C++ files.
>
> This doesn't say anything about C++17 features, just that it tells you
whether C++ exceptions are enabled at all. Since uncaught_exceptions is
part of the standard library and not the compiler, I would guess its
absence isn't a problem with clang++ as such.
Thanks Joshua.
Maybe I am parsing something incorrectly, but according to
[https://en.cppreference.com/w/User:D41D8CD98F/feature_testing_macros C++
feature test macros], `__has_feature(cxx_exceptions)` is supposed to give
me the correct answer:
> [feature test macros] provide a set of preprocessor macros which give a
simple and portable way to detect the presence of C++ standards and
experimental features.
If I understand the concept correctly, then
`__has_feature(cxx_exceptions)` should return false because
`std::uncaught_exceptions()` is not available.
Or maybe I am not understanding the word-smithing that's happening here.
As an analogy, are you saying I'm buying a car with a anti-lock brake
system but the brakes don't work and the car won't stop? (This kind of
reasoning makes no sense to me).
--
Ticket URL: <https://trac.macports.org/ticket/57578#comment:7>
MacPorts <https://www.macports.org/>
Ports system for macOS
More information about the macports-tickets
mailing list