https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71282

--- Comment #2 from Raymond Connell <rayconnell at usa dot net> ---
Thanks for responding so quickly. Sorry for the false alarm. I have no excuse.
I should have looked at the C++ versions more closely.

RSC

------ Original Message ------
Received: 11:16 PM EDT, 05/25/2016
From: "msebor at gcc dot gnu.org" <gcc-bugzi...@gcc.gnu.org>
To: rayconn...@usa.net
Subject: [Bug libgcc/71282] C,C++ function strpbrk arg 1 has wrong type on
Raspian 4.1.19

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71282

Martin Sebor <msebor at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
                 CC|                            |msebor at gcc dot gnu.org
         Resolution|---                         |INVALID

--- Comment #1 from Martin Sebor <msebor at gcc dot gnu.org> ---
Unlike in C, in C++ there are two overloads of strpbrk (declared by GLIBC on
GNU/Linux):

  const char* strpbrk (const char*, const char*);

and

  char* strpbrk (char*, const char*);

The first one is used when the first argument is a const pointer and array,
as
in the test case, and the second one otherwise.  Since the first one returns
a
const char* which is not convertible to char*, the program is incorrect.

Unfortunately, the caret in the error makes this hard to see.  Current trunk
does only slightly better:

error: invalid conversion from ‘const char*’ to ‘char*’
[-fpermissive]
     char *pSpc = strpbrk(tstStr, " ");
                  ~~~~~~~^~~~~~~~~~~~~

That might be worth raising a separate bug for (if one doesn't already
exist),
but this one is invalid.

Reply via email to