• Re: Syntax error in type_traits

    From Greg Wooledge@21:1/5 to Jesper Dybdal on Thu Jan 16 13:10:01 2025
    On Thu, Jan 16, 2025 at 12:38:29 +0100, Jesper Dybdal wrote:
    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;       |           ^

    This is not the case on my bookworm system (Debian 12.9, libstdc++-12-dev package version 12.2.0-14).

    hobbit:~$ sed -n 2614p /usr/include/c++/12/type_traits
    using enable_if_t = typename enable_if<_Cond, _Tp>::type;

    What version of the libstdc++-12-dev package do you have?

    Does reinstalling that package fix the file?

    Honestly, it's hard to imagine that this bug wouldn't have been caught,
    if it were widespread. I have to think that hundreds of people compile
    C++ programs with <string> on Debian every day.

    This feels more like a local file modification to me (either by human
    error, or file corruption, though the latter seems unlikely as well,
    since this is an *added* character, not a modified character).

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Jesper Dybdal@21:1/5 to All on Thu Jan 16 12:50:01 2025
    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

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Andy Smith@21:1/5 to Jesper Dybdal on Thu Jan 16 13:20:01 2025
    Hi Jesper,

    On Thu, Jan 16, 2025 at 12:38:29PM +0100, Jesper Dybdal wrote:
    There is a syntax error (an erroneous ">" character) in
        /usr/include/c++/12/type_traits
    in Bookworm.

    I do not experience this on my Debian 12.

    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;       |           ^

    My file doesn't have that line:

    $ cat -n /usr/include/c++/12/type_traits | head -n 2620 | tail -n 10
    2611
    2612 /// Alias template for enable_if
    2613 template<bool _Cond, typename _Tp = void>
    2614 using enable_if_t = typename enable_if<_Cond, _Tp>::type;
    2615
    2616 /// Alias template for conditional
    2617 template<bool _Cond, typename _Iftrue, typename _Iffalse>
    2618 using conditional_t = typename conditional<_Cond, _Iftrue, _Iffalse>::type;
    2619
    2620 /// Alias template for common_type

    Is your file supplied from a different package to mine?

    $ dpkg -S /usr/include/c++/12/type_traits
    libstdc++-12-dev:amd64: /usr/include/c++/12/type_traits
    $ apt policy libstdc++-12-dev:amd64
    libstdc++-12-dev:
    Installed: 12.2.0-14
    Candidate: 12.2.0-14
    Version table:
    *** 12.2.0-14 500
    500 http://acng.localnet/deb.debian.org/debian bookworm/main amd64 Packages
    100 /var/lib/dpkg/status

    Could someone familiar with the correct way of reporting such things please report this?

    First we need to work out where your file came from.

    jd@nuser:~$ g++ --version
    g++ (Debian 12.2.0-14) 12.2.0

    This matches for me, but the file in question is not from the same
    package as the g++ binary, so this doesn't prove anything.

    You may like to download the .deb file for libstdc++-12-dev, unpack it somewhere and see what else is different about your copy of that file
    (and, perhaps, others).

    Thanks,
    Andy

    --
    https://bitfolk.com/ -- No-nonsense VPS hosting

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Jesper Dybdal@21:1/5 to Greg Wooledge on Thu Jan 16 14:40:02 2025
    This is a multi-part message in MIME format.
    On 2025-01-16 13:07, Greg Wooledge wrote:
    On Thu, Jan 16, 2025 at 12:38:29 +0100, Jesper Dybdal wrote:
    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;
          |           ^
    This is not the case on my bookworm system (Debian 12.9, libstdc++-12-dev package version 12.2.0-14).

    hobbit:~$ sed -n 2614p /usr/include/c++/12/type_traits
    using enable_if_t = typename enable_if<_Cond, _Tp>::type;

    What version of the libstdc++-12-dev package do you have?
    jd@nuser:~$ apt list libstdc++-12-dev
    libstdc++-12-dev/stable,now 12.2.0-14 amd64 [installed,automatic]
    Does reinstalling that package fix the file?
    Yes, it does!
    !

    Honestly, it's hard to imagine that this bug wouldn't have been caught,
    if it were widespread. I have to think that hundreds of people compile
    C++ programs with <string> on Debian every day.
    I was quite surprised too - glad  to hear that others do not have that problem.
    This feels more like a local file modification to me (either by human
    error, or file corruption, though the latter seems unlikely as well,
    since this is an *added* character, not a modified character).
    Exactly

    I could have sworn that I verified yesterday that that header file had modification and change times that seemed plausible together with those
    of other files there.  But this morning (before the reinstall) it has a modification time of yesterday at 21:50.  And the directory has that
    same time also, but no other files there have been modified.

    But how I can have managed to add a byte in that file beats me.  I
    didn't even know that there was a file with that name, and I had not
    been near the directory before I saw the error message. And I had
    certainly not had it open in an editor.

    And about an hour ago, when I checked the file times, the other files in
    that directory had different, but old times (several with the same time,
    and several with other "same times"),  But now, after the reinstall,
    they all have 2023-01-08 as modification time.

    There is obviously nothing wrong with the package.  Sorry for bothering
    you all.

    But I am deeply confused about what is happening to my system.

    Thanks to you and Andy,
    Jesper

    --
    Jesper Dybdal
    https://www.dybdal.dk

    <!DOCTYPE html>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    </head>
    <body>
    <br>
    <div class="moz-cite-prefix">On 2025-01-16 13:07, Greg Wooledge
    wrote:<br>
    </div>
    <blockquote type="cite"
    cite="mid:20250116120700.GC29791@wooledge.org">
    <pre wrap="" class="moz-quote-pre">On Thu, Jan 16, 2025 at 12:38:29 +0100, Jesper Dybdal wrote:
    </pre>
    <blockquote type="cite">
    <pre wrap="" class="moz-quote-pre">There is a syntax error (an erroneous "&gt;" character) in
        /usr/include/c++/12/type_traits
    in Bookworm.   So compiling any program that includes the &lt;string&gt; header
    fails:

    echo "#include &lt;string&gt;" &gt;error.cpp
    g++ -c error.cpp

    Results in:

    </pre>
    <blockquote type="cite">
    <pre wrap="" class="moz-quote-pre">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 ‘&gt;’ token
     2614 |     using &gt;enable_if_t = typename enable_if&lt;_Cond, _Tp&gt;::type;
          |           ^
    </pre>
    </blockquote>
    </blockquote>
    <pre wrap="" class="moz-quote-pre">
    This is not the case on my bookworm system (Debian 12.9, libstdc++-12-dev package version 12.2.0-14).

    hobbit:~$ sed -n 2614p /usr/include/c++/12/type_traits
    using enable_if_t = typename enable_if&lt;_Cond, _Tp&gt;::type;

    What version of the libstdc++-12-dev package do you have?</pre>
    </blockquote>
    jd@nuser:~$ apt list libstdc++-12-dev<br>
    libstdc++-12-dev/stable,now 12.2.0-14 amd64 [installed,automatic]<span
    style="white-space: pre-wrap">
    </span><span style="white-space: pre-wrap">
    </span>
    <blockquote type="cite"
    cite="mid:20250116120700.GC29791@wooledge.org">
    <pre wrap="" class="moz-quote-pre">Does reinstalling that package fix the file?</pre>
    </blockquote>
    Yes, it does!<br>
    !<br>
    <br>
    <blockquote type="cite"
    cite="mid:20250116120700.GC29791@wooledge.org">
    <pre wrap="" class="moz-quote-pre">Honestly, it's hard to imagine that this bug wouldn't have been caught,
    if it were widespread. I have to think that hundreds of people compile
    C++ programs with &lt;string&gt; on Debian every day.</pre>
    </blockquote>
    I was quite surprised too - glad  to hear that others do not have
    that problem.<br>
    <blockquote type="cite"
    cite="mid:20250116120700.GC29791@wooledge.org">
    <pre wrap="" class="moz-quote-pre">
    This feels more like a local file modification to me (either by human
    error, or file corruption, though the latter seems unlikely as well,
    since this is an *added* character, not a modified character).</pre>
    </blockquote>
    Exactly<br>
    <br>
    I could have sworn that I verified yesterday that that header file
    had modification and change times that seemed plausible together
    with those of other files there.  But this morning (before the
    reinstall) it has a modification time of yesterday at 21:50.  And
    the directory has that same time also, but no other files there have
    been modified.<br>
    <br>
    But how I can have managed to add a byte in that file beats me.  I
    didn't even know that there was a file with that name, and I had not
    been near the directory before I saw the error message. And I had
    certainly not had it open in an editor.<br>
    <br>
    And about an hour ago, when I checked the file times, the other
    files in that directory had different, but old times (several with
    the same time, and several with other "same times"),  But now, after
    the reinstall, they all have 2023-01-08 as modification time.<br>
    <br>
    There is obviously nothing wrong with the package.  Sorry for
    bothering you all.<br>
    <br>
    But I am deeply confused about what is happening to my system.  <br>
    <br>
    Thanks to you and Andy,<br>
    Jesper<br>
    <pre class="moz-signature" cols="72">--
    Jesper Dybdal
    <a class="moz-txt-link-freetext" href="https://www.dybdal.dk">https://www.dybdal.dk</a></pre>
    </body>
    </html>

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)