This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libstdc++/70845] [6/7 Regression] inherited piecewise_construct_t constructor from std::pair by "using-declarations" is missing


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

--- Comment #4 from Wei-Wei Tu <tuwwcn at gmail dot com> ---
(In reply to Jonathan Wakely from comment #3)
> (In reply to Wei-Wei Tu from comment #2)
> > This is the test case
> 
> Yes, I know, I already added it in comment 1 :-)
> 
> Preprocessed source from gcc-5 fails, so this is due to some front-end
> change (either getting stricter and diagnosing something bad in the library
> headers, or a new FE bug).

This is my first time to report a bug. I'm so sorry for missing the headers.

Is the code valid according to the language standard? (I'm not so sure about
it.)

This is the words about c++17 inherited constructors referred by
using-declarations(from cppreference):

If the using-declaration refers to a constructor of a direct base of the class
being defined (e.g. using Base::Base;), all constructors of that base (ignoring
member access) are made visible to overload resolution when initializing the
derived class.

If overload resolution selects an inherited constructor, it is accessible if it
would be accessible when used to construct an object of the corresponding base
class: the accessibility of the using-declaration that introduced it is
ignored.

If overload resolution selects one of the inherited constructors when
initializing an object of such derived class, then the Base subobject from
which the constructor was inherited is initialized using the inherited
constructor, and all other bases and members of Derived are initialized as if
by the defaulted default constructor (default member initializers are used if
provided, otherwise default initialization takes place). The entire
initialization is treated as a single function call: initialization of the
parameters of the inherited constructor is sequenced-before initialization of
any base or member of the derived object.

As with using-declarations for any other non-static member functions, if an
inherited constructor matches the signature of one of the constructors of
Derived, it is hidden from lookup by the version found in Derived. If one of
the inherited constructors of Base happens to have the signature that matches a
copy/move constructor of the Derived, it does not prevent implicit generation
of Derived copy/move constructor (which then hides the inherited version,
similar to using operator=).

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]