<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 --- - nullptr conversion to bool should not be true"
href="https://llvm.org/bugs/show_bug.cgi?id=28811">28811</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>nullptr conversion to bool should not be true
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>3.9
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</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++11
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>westion717@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>dgregor@apple.com, llvm-bugs@lists.llvm.org
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>typedef decltype(nullptr) nullptr_t;
nullptr_t x1 = x1;
nullptr_t x2(x2);
static const nullptr_t x3[] = {x3[0]};
nullptr_t x4 = !x4 ? x4 : (nullptr_t)0;
template <class T> struct A {
static T x;
};
template <class T> T A<T>::x = x;
A<nullptr_t> x5;
struct B {
nullptr_t x;
B() : x(x) {}
};
nullptr_t& f()
{
static nullptr_t x = x;
return x;
}
int main()
{
if (x1 || x2 || x3[0] || x4 || x5.x)
return 1;
if (B().x || f()){
__builtin_printf("----\n");
return 1;
}
const nullptr_t x[] = {[&x]{return x[0];}()};
if (x[0])
return 1;
return 0;
}
expected return 0;
actual return 1;</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>