[prev in list] [next in list] [prev in thread] [next in thread] 

List:       llvm-bugs
Subject:    [llvm-bugs] [Bug 31816] New: Clang-CL diagnoses ternary ambiguity which cl.exe allows
From:       via llvm-bugs <llvm-bugs () lists ! llvm ! org>
Date:       2017-01-31 15:12:53
Message-ID: bug-31816-206 () http ! llvm ! org/bugs/
[Download RAW message or body]

--1485875574.8F23642.17512
Date: Tue, 31 Jan 2017 09:12:54 -0600
MIME-Version: 1.0
Content-Type: text/plain; charset="UTF-8"

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

            Bug ID: 31816
           Summary: Clang-CL diagnoses ternary ambiguity which cl.exe
                    allows
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs@nondot.org
          Reporter: steveire@gmail.com
                CC: dgregor@apple.com, llvm-bugs@lists.llvm.org
    Classification: Unclassified

Given 


    struct MyBool
    {
        MyBool(bool b = false) {}
        operator bool() const { return false; }
    };

    int main()
    {
        MyBool mb;
        bool result = true ? false : mb;
        return 0;
    }


C:\dev\tmp>cl /c main.cpp
Microsoft (R) C/C++ Optimizing Compiler Version 19.00.24325.6 for x86
Copyright (C) Microsoft Corporation.  All rights reserved.

main.cpp

C:\dev\tmp>"c:\dev\src\llvm\build\Release\msbuild-bin\cl.exe" /c main.cpp
main.cpp(11,21):  error: conditional expression is ambiguous; 'bool' can be
converted to 'MyBool' and vice versa
        bool result = true ? false : mb;
                           ^ ~~~~~   ~~
1 error generated.


It could be considered to match the behavior of cl.exe

-- 
You are receiving this mail because:
You are on the CC list for the bug.

--1485875574.8F23642.17512
Date: Tue, 31 Jan 2017 09:12:54 -0600
MIME-Version: 1.0
Content-Type: text/html; charset="UTF-8"

<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - Clang-CL diagnoses ternary ambiguity which cl.exe allows"
   href="https://llvm.org/bugs/show_bug.cgi?id=31816">31816</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Clang-CL diagnoses ternary ambiguity which cl.exe allows
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Windows NT
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>C++
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs&#64;nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>steveire&#64;gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>dgregor&#64;apple.com, llvm-bugs&#64;lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Given 


    struct MyBool
    {
        MyBool(bool b = false) {}
        operator bool() const { return false; }
    };

    int main()
    {
        MyBool mb;
        bool result = true ? false : mb;
        return 0;
    }


C:\dev\tmp&gt;cl /c main.cpp
Microsoft (R) C/C++ Optimizing Compiler Version 19.00.24325.6 for x86
Copyright (C) Microsoft Corporation.  All rights reserved.

main.cpp

C:\dev\tmp&gt;&quot;c:\dev\src\llvm\build\Release\msbuild-bin\cl.exe&quot; /c main.cpp
main.cpp(11,21):  error: conditional expression is ambiguous; 'bool' can be
converted to 'MyBool' and vice versa
        bool result = true ? false : mb;
                           ^ ~~~~~   ~~
1 error generated.


It could be considered to match the behavior of cl.exe</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>

--1485875574.8F23642.17512--

[Attachment #3 (text/plain)]

_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic