[LLVMbugs] [Bug 21086] New: Attempting to convert implicitly with explicit conversion operator generates an odd error
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Sat Sep 27 06:16:54 PDT 2014
http://llvm.org/bugs/show_bug.cgi?id=21086
Bug ID: 21086
Summary: Attempting to convert implicitly with explicit
conversion operator generates an odd error
Product: clang
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: C++11
Assignee: unassignedclangbugs at nondot.org
Reporter: lin90162 at gmail.com
CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
Classification: Unclassified
When I attempiting to convert the value which is explicitly convertible to
bool, an odd error occurs.
Below is a code to reproduce it.
class X {
explicit operator bool()
{
return false;
}
};
int main()
{
bool b = {X{}};
return 0;
}
When the code is compiled, below error will be shown.
hoge.cpp:12:10: error: no viable conversion from 'void' to 'bool'
bool b = {X{}};
^ ~~~~~
1 error generated.
where does 'void' come from? I think this error message is incorrect.
I could reproduce this bug with clang 3.4.2 in OS X, clang 3.5.0 in Linux and
clang 3.6.0 (trunk 218519) .
Below link is the output of clang 3.6.0 by online compiler.
http://melpon.org/wandbox/permlink/1n5XjHmXVIxi3CCW
--
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/20140927/6accccc9/attachment.html>
More information about the llvm-bugs
mailing list