[llvm-bugs] [Bug 49399] New: Putting std::optional to std::any seems broken with visbility=hidden

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Mar 2 09:39:17 PST 2021


https://bugs.llvm.org/show_bug.cgi?id=49399

            Bug ID: 49399
           Summary: Putting std::optional to std::any seems broken with
                    visbility=hidden
           Product: libc++
           Version: 10.0
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: All Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: predelnik at gmail.com
                CC: llvm-bugs at lists.llvm.org, mclow.lists at gmail.com

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

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210302/10999f74/attachment-0001.html>


More information about the llvm-bugs mailing list