<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 - [C++17] std:variant fails with libstdc++ from gcc-9.1.0"
   href="https://bugs.llvm.org/show_bug.cgi?id=41863">41863</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[C++17] std:variant fails with libstdc++ from gcc-9.1.0
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>8.0
          </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++'17
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>orbea@riseup.net
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>blitzrakete@gmail.com, erik.pilkington@gmail.com, llvm-bugs@lists.llvm.org, richard-llvm@metafoo.co.uk
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=21944" name="attach_21944" title="variant demo which reproduces the problem">attachment 21944</a> <a href="attachment.cgi?id=21944&action=edit" title="variant demo which reproduces the problem">[details]</a></span>
variant demo which reproduces the problem

On Slackware64-current gcc was updated from 8.3.0 to 9.1.0 and I found that
clang++ which uses libstdc++ now fails to build C++17 projects which use
'#include <variant>'. The issue does not occur with libc++.

I have attached a small demo which I have found online which can reproduce this
issue, but I first encountered the issue in the current master for dolphin-emu.

<a href="https://github.com/dolphin-emu/dolphin/commit/1d5dd5db914d94f3f612c13c6c5e1d5e711b49b5">https://github.com/dolphin-emu/dolphin/commit/1d5dd5db914d94f3f612c13c6c5e1d5e711b49b5</a>

With the example it can be reproduced:

  clang++ -std=c++17 variant.cpp -o variant -v

While both of these work:

  g++ -std=c++17 variant.cpp -o variant -v
  clang++ -std=c++17 -stdlib=libc++ variant.cpp -o variant -v

In Slackware current llvm is compiled as a single mostly complete package with
these cmake arguments.

cd build
  cmake \
    -DCMAKE_C_COMPILER="clang" \
    -DCMAKE_CXX_COMPILER="clang++" \
    -DCMAKE_C_FLAGS:STRING="$SLKCFLAGS" \
    -DCMAKE_CXX_FLAGS:STRING="$SLKCFLAGS" \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DLLVM_LIBDIR_SUFFIX=${LIBDIRSUFFIX} \
    -DCMAKE_BUILD_TYPE=Release \
    -DBUILD_SHARED_LIBS=OFF \
    -DCLANG_BUILD_SHARED_LIBS=ON \
    -DLLVM_BUILD_LLVM_DYLIB=ON \
    -DLLVM_LINK_LLVM_DYLIB=ON \
    -DLLVM_USE_LINKER=gold \
    -DLLVM_ENABLE_RTTI=ON \
    -DLLVM_ENABLE_FFI=ON \
    -DLLVM_ENABLE_ASSERTIONS=OFF \
    -DLLVM_USE_OPROFILE=ON \
    -DLLVM_INSTALL_UTILS=ON \
    -DLLVM_BINUTILS_INCDIR=/usr/include \
    -DCLANG_RESOURCE_DIR="../lib${LIBDIRSUFFIX}/clang/${VERSION}" \
    .. || exit 1

For further details please see this link.

<a href="https://mirrors.slackware.com/slackware/slackware64-current/source/d/llvm/">https://mirrors.slackware.com/slackware/slackware64-current/source/d/llvm/</a>

I will add further attachments with details.</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>