<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><span class="vcard"><a class="email" href="mailto:dblaikie@gmail.com" title="David Blaikie <dblaikie@gmail.com>"> <span class="fn">David Blaikie</span></a>
</span> changed
<a class="bz_bug_link
bz_status_RESOLVED bz_closed"
title="RESOLVED INVALID - Undefined reference error when "static const" variable is initialized in line (but works out of line)"
href="https://bugs.llvm.org/show_bug.cgi?id=38106">bug 38106</a>
<br>
<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>What</th>
<th>Removed</th>
<th>Added</th>
</tr>
<tr>
<td style="text-align:right;">Status</td>
<td>NEW
</td>
<td>RESOLVED
</td>
</tr>
<tr>
<td style="text-align:right;">Resolution</td>
<td>---
</td>
<td>INVALID
</td>
</tr>
<tr>
<td style="text-align:right;">CC</td>
<td>
</td>
<td>dblaikie@gmail.com
</td>
</tr></table>
<p>
<div>
<b><a class="bz_bug_link
bz_status_RESOLVED bz_closed"
title="RESOLVED INVALID - Undefined reference error when "static const" variable is initialized in line (but works out of line)"
href="https://bugs.llvm.org/show_bug.cgi?id=38106#c1">Comment # 1</a>
on <a class="bz_bug_link
bz_status_RESOLVED bz_closed"
title="RESOLVED INVALID - Undefined reference error when "static const" variable is initialized in line (but works out of line)"
href="https://bugs.llvm.org/show_bug.cgi?id=38106">bug 38106</a>
from <span class="vcard"><a class="email" href="mailto:dblaikie@gmail.com" title="David Blaikie <dblaikie@gmail.com>"> <span class="fn">David Blaikie</span></a>
</span></b>
<pre>This code (with the static member definition commented out) exhibits undefined
behavior due to an ODR use of 'foo' without a definition of 'foo'.
The "const static long long foo = 5;" (even with the "= 5") is only a
declaration of foo and must have an out of line definition (the initial value
("= 5") can remain in the declaration if you want/for various reasons).
If you want to keep the initial value inline at the declaration, then omit the
initial value in the definition (write it as "const long long Foo::foo;").</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>