[Bug c++/90137] Using declaration (constructor inheritance) prevents overriding

2024-04-06 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90137

Andrew Pinski  changed:

   What|Removed |Added

 Status|WAITING |RESOLVED
 Resolution|--- |INVALID

--- Comment #3 from Andrew Pinski  ---
so the reasoning is because we need to cleanup the partial initialized object.

GCC is correct in rejecting this here and clang and other compilers have same
behavior even.

[Bug c++/90137] Using declaration (constructor inheritance) prevents overriding

2019-04-18 Thread kshegunov at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90137

--- Comment #2 from Konstantin Shegunov  ---
Yes, this is the error I get.

What should happen instead is that compilation succeeds. Having the following
as declaration in using.h:

class DerivedPrivate;
class Derived final : public Base
{
public:
Derived(); // using Base::Base;
~Derived() override;

private:
std::unique_ptr d;
};


And trivially defining it in using.cpp:

Derived::Derived()
{
}


compiles correctly, i.e.
g++ -c -pipe -g -std=gnu++11 -Wall -W -fPIC -I. -o main.o main.cpp

produces no error.

[Bug c++/90137] Using declaration (constructor inheritance) prevents overriding

2019-04-18 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90137

Richard Biener  changed:

   What|Removed |Added

 Status|UNCONFIRMED |WAITING
   Last reconfirmed||2019-04-18
 Ever confirmed|0   |1

--- Comment #1 from Richard Biener  ---
It works for me with FSF GCC 8.3.0.  The attached testcase instead emits

> /space/rguenther/install/gcc-8.3/bin/g++ main.cpp -I. -S  -std=gnu++11 -g 
> -Wall -W -Wextra -fPIC
In file included from
/home/space/rguenther/install/gcc-8.3/include/c++/8.3.0/memory:80,
 from using.h:4,
 from main.cpp:1:
/home/space/rguenther/install/gcc-8.3/include/c++/8.3.0/bits/unique_ptr.h: In
instantiation of ‘void std::default_delete<_Tp>::operator()(_Tp*) const [with
_Tp = DerivedPrivate]’:
/home/space/rguenther/install/gcc-8.3/include/c++/8.3.0/bits/unique_ptr.h:274:17:
  required from ‘std::unique_ptr<_Tp, _Dp>::~unique_ptr() [with _Tp =
DerivedPrivate; _Dp = std::default_delete]’
using.h:14:7:   required from here
/home/space/rguenther/install/gcc-8.3/include/c++/8.3.0/bits/unique_ptr.h:79:16error:
invalid application of ‘sizeof’ to incomplete type ‘DerivedPrivate’
  static_assert(sizeof(_Tp)>0,
^~~