Re: configure adds -std=gnu++11 to CXX variable

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Zack,

On 5/3/24 00:54, Zack Weinberg wrote:
conftest.cpp: In function 'int main(int, char**)':
conftest.cpp:199:22: error: invalid conversion from 'const char8_t*' to
'const char*' [-fpermissive]
   199 |   char const *utf8 = u8"UTF-8 string \u2500";
Fixing these things is a high priority for Autoconf 2.73 but nobody
currently has time to work on it.  If you have time, we would
appreciate your working on it -- even just a rough draft of revised
test programs would be helpful.

Please find a trivial patch that makes the test pass when compiled with a C++20 compiler. I simply removed the line mentioned above and that sufficed. If someone knows how to write something similar that works both in C++11 and C++20, I'm very keen to hear.

I've  tested this with g++ 11.4 (Ubuntu) and the following small configure.ac

AC_INIT([hello], [1.0])
AC_LANG([C++])
AC_PROG_CXXCPP
AC_PROG_CXX
AC_CONFIG_FILES([Makefile])
AC_OUTPUT

Makefile.in:

CXX = @CXX@

and

$ autoconf

$ ./configure CXX="g++ -std=c++20"

results in Makefile:

CXX = g++ -std=c++20

whereas without the patch the resulting Makefile is

CXX = g++ -std=c++20 -std=gnu++11

I'm not sure if it's practical to add that a test in the test suite, since the expected behavior depends very much on compiler versions and so on.

Happy to help with this further if possible and when people have agreed on a what interface is ideal.

Cheers,

Peter

diff --git a/lib/autoconf/c.m4 b/lib/autoconf/c.m4
index 89f6a608..35dc7676 100644
--- a/lib/autoconf/c.m4
+++ b/lib/autoconf/c.m4
@@ -2759,7 +2759,6 @@ ac_cxx_conftest_cxx11_main='
 }
 {
   // Unicode literals
-  char const *utf8 = u8"UTF-8 string \u2500";
   char16_t const *utf16 = u"UTF-8 string \u2500";
   char32_t const *utf32 = U"UTF-32 string \u2500";
 }

[Index of Archives]     [GCC Help]     [Kernel Discussion]     [RPM Discussion]     [Red Hat Development]     [Yosemite News]     [Linux USB]     [Samba]

  Powered by Linux