https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115126

            Bug ID: 115126
           Summary: TU-local entity exposures in libstdc++
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jason at gcc dot gnu.org
  Target Milestone: ---

I tried compiling this alternate minimal version of module std:

export module std;
extern "C++" {
  #include <bits/stdc++.h>
}

and got a bunch of errors about exposures ([basic.link]/14) , most of which I
think are correct and need to be fixed in the library.

Most are complaining about the __gthread functions which are declared 'static
inline'; uses of these in standard library headers already violate the ODR.

I also see:

/home/jason/s/gcc/x86_64-pc-linux-gnu/libstdc++-v3/include/shared_mutex:216:5:
error: ‘void std::__shared_mutex_pthread::unlock()’ references internal linkage
entity ‘int std::__glibcxx_rwlock_unlock(pthread_rwlock_t*)’

which seems like the same pattern as the __gthread functions.  I would think
all of the above would be fixed by changing 'static inline' to just 'inline'.

/home/jason/s/gcc/x86_64-pc-linux-gnu/libstdc++-v3/include/future:1516:7:
error: ‘template<class _Fn, class _Alloc, class _Res, class ... _Args> virtual
std::shared_ptr<std::__future_base::_Task_state_base<_Res(_Args ...)> >
std::__future_base::_Task_state<_Fn, _Alloc, _Res(_Args ...)>::_M_reset()’
references internal linkage entity ‘template<class _Signature, class _Fn, class
_Alloc> std::shared_ptr<std::__future_base::_Task_state_base<_Signature> >
std::__create_task_state(_Fn&&, const _Alloc&)’

This looks like a typo; when __create_task_state was added in r196695, the
ChangeLog referred to it as a member of __future_base (for which declaring it
static would make sense), but it's actually a namespace-scope function. 
Presumably it always should have been inline instead of static, if it isn't
going to be a member.

In file included from
/home/jason/s/gcc/x86_64-pc-linux-gnu/libstdc++-v3/include/memory:78:
/home/jason/s/gcc/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/unique_ptr.h:1161:27:
error: ‘template<class _Tp, class _Del> constexpr const bool
std::__is_unique_ptr<std::unique_ptr<_Tp, _Dp> >’ references internal linkage
entity ‘template<class _Tp> constexpr const bool std::__is_unique_ptr<_Tp>’

This last one seems like a compiler bug; the partial specialization is also
TU-local, so this shouldn't be an error.  Though the 'static' seems unnecessary
here as well.

Reply via email to