[llvm-bugs] [Bug 44169] New: Wrong return type in std::strchr

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Nov 28 02:26:33 PST 2019


https://bugs.llvm.org/show_bug.cgi?id=44169

            Bug ID: 44169
           Summary: Wrong return type in std::strchr
           Product: clang
           Version: 9.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: bert at bertptrs.nl
                CC: blitzrakete at gmail.com, dgregor at apple.com,
                    erik.pilkington at gmail.com, llvm-bugs at lists.llvm.org,
                    richard-llvm at metafoo.co.uk

Created attachment 22876
  --> https://bugs.llvm.org/attachment.cgi?id=22876&action=edit
Minimal example showcasing the bug

According to the standard, the return type of std::strchr should be of the same
constness as the input string. This means that if you provide a char*, you
should get a char*, and if you provide a const char*, you should get a const
char* back.

It seems that Clang 9 (using libstdc++ 6.0.27 as the standard library
implementation) returns a char* regardless of input constness.

Attached is a simple program that reproduces the issue. It compiles when using
GCC (version 9.2) but doesn't in Clang.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20191128/e813d894/attachment.html>


More information about the llvm-bugs mailing list