[llvm-bugs] [Bug 49659] New: incomplete type with gcc and libc++ when overloading std::swap

via llvm-bugs llvm-bugs at lists.llvm.org
Sat Mar 20 08:36:14 PDT 2021


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

            Bug ID: 49659
           Summary: incomplete type with gcc and libc++ when overloading
                    std::swap
           Product: libc++
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: All Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: yichen.yan at inf.ethz.ch
                CC: llvm-bugs at lists.llvm.org, mclow.lists at gmail.com

Created attachment 24662
  --> https://bugs.llvm.org/attachment.cgi?id=24662&action=edit
test.clang.merged.proc.cc

I'm following the instructions on https://libcxx.llvm.org/docs/UsingLibcxx.html
to use libc++ with gcc,
and have met this failure:

root at 24a281e738f9:/test/clang# /usr/bin/c++ -nostdinc++
-I/libcxx-install-11/include/c++/v1 -o /dev/null -c test.clang.merged.proc.cc
test.clang.merged.proc.cc: In instantiation of 'Pointer<T>::Pointer(const
Pointer<T>&) [with T = d]':
/libcxx-install-11/include/c++/v1/type_traits:4075:9:   required from 'typename
std::__1::enable_if<(std::__1::is_move_constructible<_Tp>::value &&
std::__1::is_move_assignable<_Tp>::value)>::type std::__1::swap(_Tp&, _Tp&)
[with _Tp = Pointer<d>; typename
std::__1::enable_if<(std::__1::is_move_constructible<_Tp>::value &&
std::__1::is_move_assignable<_Tp>::value)>::type = void]'
test.clang.merged.proc.cc:39:46:   required from here
test.clang.merged.proc.cc:23:33: error: invalid use of incomplete type 'class
d'
   Pointer(const Pointer &) { b->c; }
                              ~~~^
test.clang.merged.proc.cc:30:7: note: forward declaration of 'class d'
 class d;
       ^

Notably, this works with clang and {libstdc++,libc++}.

-- 
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/20210320/a9dfcc84/attachment.html>


More information about the llvm-bugs mailing list