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: unassignedclangb...@nondot.org
          Reporter: b...@bertptrs.nl
                CC: blitzrak...@gmail.com, dgre...@apple.com,
                    erik.pilking...@gmail.com, llvm-bugs@lists.llvm.org,
                    richard-l...@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to