[llvm-bugs] [Bug 31816] New: Clang-CL diagnoses ternary ambiguity which cl.exe allows
via llvm-bugs
llvm-bugs at lists.llvm.org
Tue Jan 31 07:12:53 PST 2017
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 at nondot.org
Reporter: steveire at gmail.com
CC: dgregor at apple.com, llvm-bugs at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20170131/f9ac1ff6/attachment.html>
More information about the llvm-bugs
mailing list