[MacPorts] #70341: g++ fails to compile when -libstd=libc++ is set
MacPorts
noreply at macports.org
Tue Jul 9 17:46:58 UTC 2024
#70341: g++ fails to compile when -libstd=libc++ is set
--------------------------------+--------------------
Reporter: mouse07410 | Owner: (none)
Type: defect | Status: new
Priority: Normal | Milestone:
Component: ports | Version:
Resolution: | Keywords:
Port: gcc12 gcc13 gcc14 |
--------------------------------+--------------------
Comment (by mouse07410):
Well, this is an annoyingly stupid problem - and I came up with an equally
stupid workaround:
{{{
--- /opt/local/libexec/gcc14/libc++/include/c++/v1/cstdlib.orig 2024-07-09
13:43:11
+++ /opt/local/libexec/gcc14/libc++/include/c++/v1/cstdlib 2024-07-09
13:42:41
@@ -142,7 +142,7 @@
using ::mbstowcs _LIBCPP_USING_IF_EXISTS;
using ::wcstombs _LIBCPP_USING_IF_EXISTS;
#endif
-#if !defined(_LIBCPP_CXX03_LANG)
+#if !defined(_LIBCPP_CXX03_LANG) && 0
using ::at_quick_exit _LIBCPP_USING_IF_EXISTS;
using ::quick_exit _LIBCPP_USING_IF_EXISTS;
#endif
}}}
With it, {{{-libstd=libc++}}} mostly works:
{{{
$ cat t-sstream.cpp
#include <string>
#include <iostream>
#include <sstream>
int main () {
std::ostringstream foo;
std::stringstream boo;
foo.str("Test string");
boo.str("Example string");
//std::cout << foo << std::endl;
std::cout << foo.str() << std::endl;
foo << boo.str();
//std::cout << foo << std::endl;
std::cout << foo.str() << std::endl;
return 0;
}
$ g++-mp-14 -pipe -stdlib=libc++ -std=gnu++20 -o t t-sstream.cpp
$ ./t
Test string
Example string
$
}}}
--
Ticket URL: <https://trac.macports.org/ticket/70341#comment:7>
MacPorts <https://www.macports.org/>
Ports system for macOS
More information about the macports-tickets
mailing list