public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/52707] New: [C++11] Deleted special member function prevent type being an aggregate
@ 2012-03-25 14:59 daniel.kruegler at googlemail dot com
  2012-04-13 21:16 ` [Bug c++/52707] " jason at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: daniel.kruegler at googlemail dot com @ 2012-03-25 14:59 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52707

             Bug #: 52707
           Summary: [C++11] Deleted special member function prevent type
                    being an aggregate
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: daniel.kruegler@googlemail.com
                CC: jason@gcc.gnu.org


gcc 4.8.0 20120318 (experimental) in C++11 mode rejects the following code:

//---
struct A {
 int m;
 A() = delete;
};

A a = {1}; // line 6
//---

"6|error: could not convert '{1}' from '<brace-enclosed initializer list>' to
'A'|"

But according to N3290 (N3376 still the same) the user-declared, deleted
default-constructor should not prevent A from being an aggregate type and
aggregate initialization should happen here. The error text implies that A is
considered as a non-aggregate and no feasible constructor is found.

According to 8.4.2 p4:

"A function is user-provided if it is user-declared and not explicitly
defaulted or deleted on its first declaration."

and by 8.5.1 p1:

"An aggregate is [..] a class (Clause 9) with no user-provided constructors"

Thus, the deleted default constructor is not a user-provided constructor and
aggregate initialization should work.

This is due to DR 1135 which is already part of C++11:

http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#1135


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/52707] [C++11] Deleted special member function prevent type being an aggregate
  2012-03-25 14:59 [Bug c++/52707] New: [C++11] Deleted special member function prevent type being an aggregate daniel.kruegler at googlemail dot com
@ 2012-04-13 21:16 ` jason at gcc dot gnu.org
  2012-04-15 17:15 ` jason at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: jason at gcc dot gnu.org @ 2012-04-13 21:16 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52707

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2012-04-13
         AssignedTo|unassigned at gcc dot       |jason at gcc dot gnu.org
                   |gnu.org                     |
     Ever Confirmed|0                           |1


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/52707] [C++11] Deleted special member function prevent type being an aggregate
  2012-03-25 14:59 [Bug c++/52707] New: [C++11] Deleted special member function prevent type being an aggregate daniel.kruegler at googlemail dot com
  2012-04-13 21:16 ` [Bug c++/52707] " jason at gcc dot gnu.org
@ 2012-04-15 17:15 ` jason at gcc dot gnu.org
  2012-04-15 17:16 ` jason at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: jason at gcc dot gnu.org @ 2012-04-15 17:15 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52707

--- Comment #1 from Jason Merrill <jason at gcc dot gnu.org> 2012-04-15 17:15:40 UTC ---
Created attachment 27161
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=27161
partial patch

This patch fixes the bug, but breaks several other tests in the testsuite,
because many places in the compiler assume that if the constructor isn't
callable, it's also non-trivial.  This needs to be fixed, but for the moment
I'm going to look at lower-hanging fruit.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/52707] [C++11] Deleted special member function prevent type being an aggregate
  2012-03-25 14:59 [Bug c++/52707] New: [C++11] Deleted special member function prevent type being an aggregate daniel.kruegler at googlemail dot com
  2012-04-13 21:16 ` [Bug c++/52707] " jason at gcc dot gnu.org
  2012-04-15 17:15 ` jason at gcc dot gnu.org
@ 2012-04-15 17:16 ` jason at gcc dot gnu.org
  2013-12-09  9:36 ` paolo.carlini at oracle dot com
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: jason at gcc dot gnu.org @ 2012-04-15 17:16 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52707

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |NEW
         AssignedTo|jason at gcc dot gnu.org    |unassigned at gcc dot
                   |                            |gnu.org


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/52707] [C++11] Deleted special member function prevent type being an aggregate
  2012-03-25 14:59 [Bug c++/52707] New: [C++11] Deleted special member function prevent type being an aggregate daniel.kruegler at googlemail dot com
                   ` (2 preceding siblings ...)
  2012-04-15 17:16 ` jason at gcc dot gnu.org
@ 2013-12-09  9:36 ` paolo.carlini at oracle dot com
  2013-12-09  9:50 ` paolo at gcc dot gnu.org
  2013-12-09  9:53 ` paolo.carlini at oracle dot com
  5 siblings, 0 replies; 7+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-12-09  9:36 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52707

--- Comment #2 from Paolo Carlini <paolo.carlini at oracle dot com> ---
This is fixed in mainline. I'm adding the testcase and closing the bug.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/52707] [C++11] Deleted special member function prevent type being an aggregate
  2012-03-25 14:59 [Bug c++/52707] New: [C++11] Deleted special member function prevent type being an aggregate daniel.kruegler at googlemail dot com
                   ` (3 preceding siblings ...)
  2013-12-09  9:36 ` paolo.carlini at oracle dot com
@ 2013-12-09  9:50 ` paolo at gcc dot gnu.org
  2013-12-09  9:53 ` paolo.carlini at oracle dot com
  5 siblings, 0 replies; 7+ messages in thread
From: paolo at gcc dot gnu.org @ 2013-12-09  9:50 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52707

--- Comment #3 from paolo at gcc dot gnu.org <paolo at gcc dot gnu.org> ---
Author: paolo
Date: Mon Dec  9 09:50:51 2013
New Revision: 205801

URL: http://gcc.gnu.org/viewcvs?rev=205801&root=gcc&view=rev
Log:
2013-12-09  Paolo Carlini  <paolo.carlini@oracle.com>

    PR c++/52707
    * g++.dg/cpp0x/deleted2.C: New.

Added:
    trunk/gcc/testsuite/g++.dg/cpp0x/deleted2.C
Modified:
    trunk/gcc/testsuite/ChangeLog


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug c++/52707] [C++11] Deleted special member function prevent type being an aggregate
  2012-03-25 14:59 [Bug c++/52707] New: [C++11] Deleted special member function prevent type being an aggregate daniel.kruegler at googlemail dot com
                   ` (4 preceding siblings ...)
  2013-12-09  9:50 ` paolo at gcc dot gnu.org
@ 2013-12-09  9:53 ` paolo.carlini at oracle dot com
  5 siblings, 0 replies; 7+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-12-09  9:53 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52707

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED
   Target Milestone|---                         |4.9.0

--- Comment #4 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Done.


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2013-12-09  9:53 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-25 14:59 [Bug c++/52707] New: [C++11] Deleted special member function prevent type being an aggregate daniel.kruegler at googlemail dot com
2012-04-13 21:16 ` [Bug c++/52707] " jason at gcc dot gnu.org
2012-04-15 17:15 ` jason at gcc dot gnu.org
2012-04-15 17:16 ` jason at gcc dot gnu.org
2013-12-09  9:36 ` paolo.carlini at oracle dot com
2013-12-09  9:50 ` paolo at gcc dot gnu.org
2013-12-09  9:53 ` paolo.carlini at oracle dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).