[llvm-bugs] [Bug 45725] New: Prebuilt Windows x64 binary allows conversion from false to pointer

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Apr 28 21:24:59 PDT 2020


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

            Bug ID: 45725
           Summary: Prebuilt Windows x64 binary allows conversion from
                    false to pointer
           Product: clang
           Version: 10.0
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++17
          Assignee: unassignedclangbugs at nondot.org
          Reporter: phork at seiryu.org
                CC: blitzrakete at gmail.com, erik.pilkington at gmail.com,
                    llvm-bugs at lists.llvm.org, richard-llvm at metafoo.co.uk

Created attachment 23416
  --> https://bugs.llvm.org/attachment.cgi?id=23416&action=edit
test code

Prebuilt clang for Windows x64 which can be downloaded from
https://llvm.org/builds/ compiles the test code with the following output. I
tried both 11.0.0(2663a25f) and 10.0.0.

============
>"\Program Files\LLVM\bin\clang.exe" -Wall -Wextra -std=c++17 -c test1.cpp
test.cpp:6:28: warning: initialization of pointer of type 'const char *' to
null
      from a constant boolean expression [-Wbool-conversion]
    [[maybe_unused]] s t = false;
                           ^~~~~
1 warning generated.
============

Expected result is error like below.

============
test.cpp:6:24: error: no viable conversion from 'bool' to 's'
    [[maybe_unused]] s t = false;
                       ^   ~~~~~
test.cpp:1:8: note: candidate constructor (the implicit copy constructor) not
      viable: no known conversion from 'bool' to 'const s &' for 1st argument
struct s {
       ^
test.cpp:1:8: note: candidate constructor (the implicit move constructor) not
      viable: no known conversion from 'bool' to 's &&' for 1st argument
struct s {
       ^
test.cpp:2:5: note: candidate constructor not viable: no known conversion from
      'bool' to 'const char *' for 1st argument
    s(const char *) {}
    ^
1 error generated.
============

-- 
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/20200429/a0b00db0/attachment.html>


More information about the llvm-bugs mailing list