Re: TYPE_NEEDS_CONSTRUCTING zero for std::string?

2021-10-02 Thread Jonathan Wakely via Gcc
On Fri, 1 Oct 2021, 23:30 Martin Sebor via Gcc,  wrote:

> On 10/1/21 11:44 AM, Florian Weimer wrote:
> > * Martin Sebor via Gcc:
> >
> >> I'd expect TYPE_NEEDS_CONSTRUCTING to be non-zero in the middle end
> >> for any C++ type with a user-defined ctor, but in some of my testing
> >> I see it's actually zero for std::string, at least in some instances
> >> (but nonzero for other types with ctors).  Is there something special
> >> about std::string that makes it so?  (If this is intentional, how can
> >> I create my own type that has a user-defined ctor and also a zero
> >> TYPE_NEEDS_CONSTRUCTING?)
> >
> > I assume by writing an explicit default constructor:
> >
> >T() = default;
>
> Yes, but in a class that also defines (non-defaulted) ctors
> TYPE_NEEDS_CONSTRUCTING() is nonzero.
>
> I'm looking for a type that defines a ctor (the above just declares
> one) that has a zero for TYPE_NEEDS_CONSTRUCTING(T).  GCC documents
> the macro as:
>
> /* Indicates that objects of this type must be initialized by calling a
> function when they are created.  */
>
> So assuming TYPE_NEEDS_CONSTRUCTING(std::string) is supposed to return
> zero (i.e., it's not a bug or some oddity I'm seeing) I want to know
> how to define a class like it, with one or more user-defined ctors,
> for which TYPE_NEEDS_CONSTRUCTING() also returns zero.  Otherwise,
> if it's a bug, I'll see if I can come up with a test case for it.
>


This seems surprising, I don't know why std string would need or get any
special treatment in this respect. I'm not aware of any magic for std::
string except for the custom mangling that is defined by the ABI for it
(which doesn't apply to our new std::__cxx11::string anyway).

>


gcc-11-20211002 is now available

2021-10-02 Thread GCC Administrator via Gcc
Snapshot gcc-11-20211002 is now available on
  https://gcc.gnu.org/pub/gcc/snapshots/11-20211002/
and on various mirrors, see http://gcc.gnu.org/mirrors.html for details.

This snapshot has been generated from the GCC 11 git branch
with the following options: git://gcc.gnu.org/git/gcc.git branch 
releases/gcc-11 revision 509dd37480297207dc1c28671d6776252789ac10

You'll find:

 gcc-11-20211002.tar.xz   Complete GCC

  SHA256=b0bbd6e103bb07f1467bf4be8e4b80791840da665762377eefff27e5f6b03c53
  SHA1=45556668dbc83a468ba6083bf9c956c9bc179cbb

Diffs from 11-20210925 are available in the diffs/ subdirectory.

When a particular snapshot is ready for public consumption the LATEST-11
link is updated and a message is sent to the gcc list.  Please do not use
a snapshot before it has been announced that way.