[Bug 3928] assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]

bugzilla-daemon at mindrot.org bugzilla-daemon at mindrot.org
Fri Aug 21 17:10:43 AEST 2026


https://bugzilla.mindrot.org/show_bug.cgi?id=3928

Darren Tucker <dtucker at dtucker.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dtucker at dtucker.net

--- Comment #2 from Darren Tucker <dtucker at dtucker.net> ---
Maybe ./configure --with-cflags=-std=gnu23?   I can see it on Fedora
with gcc 16.1.1 and glibc-2.43-8 without any flags and-std=gnu23 is the
default, but interestingly the warning does not happen with -std=c23.

Anyway they seem to have made strchr and strrchr generics in C23. 
https://en.cppreference.com/c/string/byte/strchr says


    2) Type-generic function equivalent to (1). Let T be an unqualified
    character object type.
    If str is of type const T*, the return type is const char*.
    Otherwise, if str is of type T*, the return type is char*.
    Otherwise, the behavior is undefined.

-- 
You are receiving this mail because:
You are watching the assignee of the bug.
You are watching someone on the CC list of the bug.


More information about the openssh-bugs mailing list