There is a syntax error (an erroneous ">" character) in
/usr/include/c++/12/type_traits
in Bookworm. So compiling any program that includes the <string>
header fails:
echo "#include <string>" >error.cpp
g++ -c error.cpp
Results in:
In file included from /usr/include/c++/12/bits/char_traits.h:42,
from /usr/include/c++/12/string:40,
from error.cpp:1:
/usr/include/c++/12/type_traits:2614:11: error: expected identifier
before ‘>’ token
2614 | using >enable_if_t = typename enable_if<_Cond, _Tp>::type;
| ^
/usr/include/c++/12/type_traits:2614:11: error: expected
unqualified-id before ‘>’ token
In file included from /usr/include/c++/12/bits/refwrap.h:38,
from /usr/include/c++/12/string:51:
/usr/include/c++/12/bits/invoke.h:103:15: error: ‘enable_if_t’ does
not name a type; did you mean ‘enable_if’?
103 | constexpr enable_if_t<is_invocable_r_v<_Res, _Callable,
_Args...>, _Res>
and a lot of other error messages (quoted in full below).
It compiles wiithout problems with -std=c++11.
It also compiles without problems if the strange ">" (in "using
>enable_if_t = ") is removed.
Could someone familiar with the correct way of reporting such things
please report this?
Versions:
jd@nuser:~$ cat /etc/debian_version
12.9
jd@nuser:~$ g++ --version
g++ (Debian 12.2.0-14) 12.2.0
jd@nuser:~$ ldd --version
ldd (Debian GLIBC 2.36-9+deb12u9) 2.36
The full set of error messages is:
In file included from /usr/include/c++/12/bits/char_traits.h:42,
from /usr/include/c++/12/string:40,
from error.cpp:1:
/usr/include/c++/12/type_traits:2614:11: error: expected identifier
before ‘>’ token
2614 | using >enable_if_t = typename enable_if<_Cond, _Tp>::type;
| ^
/usr/include/c++/12/type_traits:2614:11: error: expected
unqualified-id before ‘>’ token
In file included from /usr/include/c++/12/bits/refwrap.h:38,
from /usr/include/c++/12/string:51:
/usr/include/c++/12/bits/invoke.h:103:15: error: ‘enable_if_t’ does
not name a type; did you mean ‘enable_if’?
103 | constexpr enable_if_t<is_invocable_r_v<_Res, _Callable,
_Args...>, _Res>
| ^~~~~~~~~~~
| enable_if
In file included from /usr/include/c++/12/string:53:
/usr/include/c++/12/bits/basic_string.h:155:24: error: ‘enable_if_t’
does not name a type; did you mean ‘enable_if’?
155 | using _If_sv = enable_if_t<
| ^~~~~~~~~~~
| enable_if
/usr/include/c++/12/bits/basic_string.h:772:27: error: ‘enable_if_t’
does not name a type; did you mean ‘enable_if’?
772 | typename = enable_if_t<is_convertible_v<const
_Tp&, __sv_type>>>
| ^~~~~~~~~~~
| enable_if
/usr/include/c++/12/bits/basic_string.h:772:38: error: expected ‘>’
before ‘<’ token
772 | typename = enable_if_t<is_convertible_v<const
_Tp&, __sv_type>>>
| ^
/usr/include/c++/12/bits/basic_string.h:783:41: error: ‘_If_sv’ does
not name a type
783 | template<typename _Tp, typename = _If_sv<_Tp, void>>
| ^~~~~~
/usr/include/c++/12/bits/basic_string.h:783:47: error: expected ‘>’
before ‘<’ token
783 | template<typename _Tp, typename = _If_sv<_Tp, void>>
| ^
/usr/include/c++/12/bits/basic_string.h:927:8: error: ‘_If_sv’ does
not name a type
927 | _If_sv<_Tp, basic_string&>
| ^~~~~~
/usr/include/c++/12/bits/basic_string.h:1375:9: error: ‘_If_sv’ does
not name a type
1375 | _If_sv<_Tp, basic_string&>
| ^~~~~~
/usr/include/c++/12/bits/basic_string.h:1492:9: error: ‘_If_sv’ does
not name a type
1492 | _If_sv<_Tp, basic_string&>
| ^~~~~~
/usr/include/c++/12/bits/basic_string.h:1508:9: error: ‘_If_sv’ does
not name a type
1508 | _If_sv<_Tp, basic_string&>
| ^~~~~~
/usr/include/c++/12/bits/basic_string.h:1704:9: error: ‘_If_sv’ does
not name a type
1704 | _If_sv<_Tp, basic_string&>
| ^~~~~~
/usr/include/c++/12/bits/basic_string.h:1720:9: error: ‘_If_sv’ does
not name a type
1720 | _If_sv<_Tp, basic_string&>
| ^~~~~~
/usr/include/c++/12/bits/basic_string.h:1986:9: error: ‘_If_sv’ does
not name a type
1986 | _If_sv<_Tp, basic_string&>
| ^~~~~~
/usr/include/c++/12/bits/basic_string.h:2003:9: error: ‘_If_sv’ does
not name a type
2003 | _If_sv<_Tp, basic_string&>
| ^~~~~~
/usr/include/c++/12/bits/basic_string.h:2439:9: error: ‘_If_sv’ does
not name a type
2439 | _If_sv<_Tp, basic_string&>
| ^~~~~~
/usr/include/c++/12/bits/basic_string.h:2457:9: error: ‘_If_sv’ does
not name a type
2457 | _If_sv<_Tp, basic_string&>
| ^~~~~~
/usr/include/c++/12/bits/basic_string.h:2479:9: error: ‘_If_sv’ does
not name a type
2479 | _If_sv<_Tp, basic_string&>
| ^~~~~~
/usr/include/c++/12/bits/basic_string.h:2633:9: error: ‘_If_sv’ does
not name a type
2633 | _If_sv<_Tp, size_type>
| ^~~~~~
/usr/include/c++/12/bits/basic_string.h:2699:9: error: ‘_If_sv’ does
not name a type
2699 | _If_sv<_Tp, size_type>
| ^~~~~~
/usr/include/c++/12/bits/basic_string.h:2784:9: error: ‘_If_sv’ does
not name a type
2784 | _If_sv<_Tp, size_type>
| ^~~~~~
/usr/include/c++/12/bits/basic_string.h:2873:9: error: ‘_If_sv’ does
not name a type
2873 | _If_sv<_Tp, size_type>
| ^~~~~~
/usr/include/c++/12/bits/basic_string.h:2960:9: error: ‘_If_sv’ does
not name a type
2960 | _If_sv<_Tp, size_type>
| ^~~~~~
/usr/include/c++/12/bits/basic_string.h:3048:9: error: ‘_If_sv’ does
not name a type
3048 | _If_sv<_Tp, size_type>
| ^~~~~~
/usr/include/c++/12/bits/basic_string.h:3162:9: error: ‘_If_sv’ does
not name a type
3162 | _If_sv<_Tp, int>
| ^~~~~~
/usr/include/c++/12/bits/basic_string.h:3187:9: error: ‘_If_sv’ does
not name a type
3187 | _If_sv<_Tp, int>
| ^~~~~~
/usr/include/c++/12/bits/basic_string.h:3207:9: error: ‘_If_sv’ does
not name a type
3207 | _If_sv<_Tp, int>
| ^~~~~~
Thanks,
Jesper
--
Jesper Dybdal
https://www.dybdal.dk