On 11/28/23 11:03, Thomas Schwinge wrote:
Hi!

On 2023-11-17T14:50:45+0000, Alex Coplan <alex.cop...@arm.com> wrote:
--- a/gcc/cp/cp-objcp-common.cc
+++ b/gcc/cp/cp-objcp-common.cc

+/* Table of features for __has_{feature,extension}.  */
+
+static constexpr cp_feature_info cp_feature_table[] =
+{
+  { "cxx_exceptions", &flag_exceptions },
+  { "cxx_rtti", &flag_rtti },
+  { "cxx_access_control_sfinae", { cxx11, cxx98 } },

Here we see that 'cxx_exceptions', 'cxx_rtti' are dependent on
'-fexceptions', '-frtti'.  Certain GCC configurations may decide to
default to '-fno-exceptions' and/or '-fno-rtti'...

--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/has-feature.C
@@ -0,0 +1,206 @@
+// { dg-do compile }
+// { dg-options "" }
+
+#define FEAT(x) (__has_feature(x) && __has_extension(x))
+#define CXX11 (__cplusplus >= 201103L)
+#define CXX14 (__cplusplus >= 201402L)
+
+#if !FEAT(cxx_exceptions) || !FEAT(cxx_rtti)
+#error
+#endif

..., but here, they are assumed available unconditionally.  OK to push
"Adjust 'g++.dg/ext/has-feature.C' for default-'-fno-exceptions', '-fno-rtti' 
configurations",
see attached?

OK.

Grüße
  Thomas


-----------------
Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 
München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas 
Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht 
München, HRB 106955

Reply via email to