<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 - Putting std::optional to std::any seems broken with visbility=hidden"
   href="https://bugs.llvm.org/show_bug.cgi?id=49399">49399</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Putting std::optional to std::any seems broken with visbility=hidden
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libc++
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>10.0
          </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>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>All Bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>predelnik@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org, mclow.lists@gmail.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>a.cpp:

#include <optional>
#include <any>

std::optional<int> f (const std::any &value)
{
  return std::any_cast<std::optional<int>> (value);
}

std::any g ();

int main ()
{
  return f (g ()).value_or (0);
}

b.cpp:

#include <any>
#include <optional>

[[gnu::visibility("default")]] std::any g () { return std::make_optional (1); }

Running with:
clang++ -stdlib=libc++ b.cpp -std=c++20 -shared -fPIC -o b.so
-fvisibility=hidden
clang++ -stdlib=libc++ a.cpp -std=c++20 -L . -l:b.so
LD_LIBRARY_PATH=. ./a.out

Example works fine with libstdc++, seems like something is wrong with
std::optional visbiility</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>