-
Notifications
You must be signed in to change notification settings - Fork 15.7k
Open
Labels
c++23clang:frontendLanguage frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"constexprAnything related to constant evaluationAnything related to constant evaluationdiverges-from:gccDoes the clang frontend diverge from gcc on this issueDoes the clang frontend diverge from gcc on this issuediverges-from:msvcDoes the clang frontend diverge from msvc on this issueDoes the clang frontend diverge from msvc on this issuerejects-valid
Description
#include <memory>
class C
{
public:
C();
~C();
private:
struct Impl;
std::unique_ptr<Impl> mImpl;
};
C::C() = default;
C::~C() = default;
struct C::Impl {};This fails with -std=c++23:
In file included from <source>:1:
In file included from /opt/compiler-explorer/gcc-snapshot/lib/gcc/x86_64-linux-gnu/16.0.0/../../../../include/c++/16.0.0/memory:80:
/opt/compiler-explorer/gcc-snapshot/lib/gcc/x86_64-linux-gnu/16.0.0/../../../../include/c++/16.0.0/bits/unique_ptr.h:90:16: error: invalid application of 'sizeof' to an incomplete type 'C::Impl'
90 | static_assert(sizeof(_Tp)>0,
| ^~~~~~~~~~~
/opt/compiler-explorer/gcc-snapshot/lib/gcc/x86_64-linux-gnu/16.0.0/../../../../include/c++/16.0.0/bits/unique_ptr.h:398:4: note: in instantiation of member function 'std::default_delete<C::Impl>::operator()' requested here
398 | get_deleter()(std::move(__ptr));
| ^
<source>:14:4: note: in instantiation of member function 'std::unique_ptr<C::Impl>::~unique_ptr' requested here
14 | C::C() = default;
| ^
<source>:14:10: note: in defaulted default constructor for 'C' first required here
14 | C::C() = default;
| ^
<source>:10:12: note: forward declaration of 'C::Impl'
10 | struct Impl;
| ^
It builds fine with all previous standards as well as GCC and MSVC using C++23.
Metadata
Metadata
Assignees
Labels
c++23clang:frontendLanguage frontend issues, e.g. anything involving "Sema"Language frontend issues, e.g. anything involving "Sema"constexprAnything related to constant evaluationAnything related to constant evaluationdiverges-from:gccDoes the clang frontend diverge from gcc on this issueDoes the clang frontend diverge from gcc on this issuediverges-from:msvcDoes the clang frontend diverge from msvc on this issueDoes the clang frontend diverge from msvc on this issuerejects-valid