<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </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 - static data member "unresolved external symbol" if constexpr is used in its definition"
   href="https://bugs.llvm.org/show_bug.cgi?id=34754">34754</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>static data member "unresolved external symbol" if constexpr is used in its definition
          </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++11
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>powerchord@web.de
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>dgregor@apple.com, llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>// header.h
struct S { static int const i; };

// source.cpp
#include "header.h"
constexpr int const S::i = 0;

// main.cpp
#include "header.h"
int main()
{
return S::i; // error or OK, depending on "C++ Language Standard" in compiler
options
}

If compiled with clang and "ISO C++ Latest Draft Standard (/std:c++latest)":
linker error "unresolved external symbol"

If compiled with clang and "ISO C++17 Standard (/std:c++17)" or "ISO C++14
Standard (/std:c++14)": OK

If compiled with VC: OK in all cases

I'm using Visual Studio 2017 on Windows 10 64-bit and the latest clang for
Windows.
Can someone tell me what's going on here? Is this a bug in clang?
S::i has external linkage, but clang seems to transform it into internal
linkage if constexpr is in the definition. Why?</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>