public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/44499] No default constructor available
       [not found] <bug-44499-4@http.gcc.gnu.org/bugzilla/>
@ 2011-03-03 22:28 ` dirtyepic at gentoo dot org
  2011-03-03 23:14 ` redi at gcc dot gnu.org
                   ` (11 subsequent siblings)
  12 siblings, 0 replies; 23+ messages in thread
From: dirtyepic at gentoo dot org @ 2011-03-03 22:28 UTC (permalink / raw)
  To: gcc-bugs

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

Ryan Hill <dirtyepic at gentoo dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dirtyepic at gentoo dot org

--- Comment #10 from Ryan Hill <dirtyepic at gentoo dot org> 2011-03-03 22:28:45 UTC ---
(In reply to comment #3)
> (In reply to comment #1)
> > gcc is correct, accepting the code previously was a bug that was fixed recently
> > 
> > You need to provide an initializer for g_d
> 
> This sort of changes should be documented in the changes.html page or in
> porting_to.html

Could this be added?  Some upstreams are arguing this is a bug in GCC.  In the
past we've found that if it's documented that this change was indeed
intentional, they're more willing to fix their code.


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

* [Bug c++/44499] No default constructor available
       [not found] <bug-44499-4@http.gcc.gnu.org/bugzilla/>
  2011-03-03 22:28 ` [Bug c++/44499] No default constructor available dirtyepic at gentoo dot org
@ 2011-03-03 23:14 ` redi at gcc dot gnu.org
  2011-03-03 23:16 ` redi at gcc dot gnu.org
                   ` (10 subsequent siblings)
  12 siblings, 0 replies; 23+ messages in thread
From: redi at gcc dot gnu.org @ 2011-03-03 23:14 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #11 from Jonathan Wakely <redi at gcc dot gnu.org> 2011-03-03 23:14:10 UTC ---
(In reply to comment #10)
> (In reply to comment #3)
> > (In reply to comment #1)
> > > gcc is correct, accepting the code previously was a bug that was fixed recently
> > > 
> > > You need to provide an initializer for g_d
> > 
> > This sort of changes should be documented in the changes.html page or in
> > porting_to.html

I prepared this:

    <li>As required by the C++ standard, G++ no longer allows objects of
    const-qualified type to be default initialized unless the type has a
    user-declared default constructor.  Code that fails to compile can be
    fixed by providing an initializer e.g.
    <pre>
    struct S { };
    const S s = S();
    </pre>
    Use <code>-fpermissive</code> to allow the old, non-conforming behaviour.
    </li>

However ...

> Could this be added?  Some upstreams are arguing this is a bug in GCC.  In the
> past we've found that if it's documented that this change was indeed
> intentional, they're more willing to fix their code.

GCC 4.4 and 4.5 reject the example too, so I don't know when the bug was fixed,
it's apparently not a change in 4.6 (though there were some bugs in this area
fixed recently.)

Upstream will have to accept that G++ (like Clang++ and EDG) conforms to the
standard in this respect.


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

* [Bug c++/44499] No default constructor available
       [not found] <bug-44499-4@http.gcc.gnu.org/bugzilla/>
  2011-03-03 22:28 ` [Bug c++/44499] No default constructor available dirtyepic at gentoo dot org
  2011-03-03 23:14 ` redi at gcc dot gnu.org
@ 2011-03-03 23:16 ` redi at gcc dot gnu.org
  2011-03-04 10:02 ` manu at gcc dot gnu.org
                   ` (9 subsequent siblings)
  12 siblings, 0 replies; 23+ messages in thread
From: redi at gcc dot gnu.org @ 2011-03-03 23:16 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #12 from Jonathan Wakely <redi at gcc dot gnu.org> 2011-03-03 23:16:41 UTC ---
Manu, can we close this?


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

* [Bug c++/44499] No default constructor available
       [not found] <bug-44499-4@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2011-03-03 23:16 ` redi at gcc dot gnu.org
@ 2011-03-04 10:02 ` manu at gcc dot gnu.org
  2011-03-04 11:23 ` redi at gcc dot gnu.org
                   ` (8 subsequent siblings)
  12 siblings, 0 replies; 23+ messages in thread
From: manu at gcc dot gnu.org @ 2011-03-04 10:02 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #13 from Manuel López-Ibáñez <manu at gcc dot gnu.org> 2011-03-04 10:02:19 UTC ---
(In reply to comment #12)
> Manu, can we close this?

@Jonathan

I still think that the messages of Comeau and Clang are better than GCC's. I
will try for 4.7 to produce a patch to change the message to be like:

error: default initialization of const object 'g_d' requires a user-provided
default constructor [-fpermissive]
note: 'const class D' has no user-provided default constructor

Do you agree? 

(I'd like to keep the note to jump to the declaration of class D).

@Piotr,Ryan

I started a list of GCC diagnostics in the wiki. 

http://gcc.gnu.org/wiki/VerboseDiagnostics

There is only one but the idea would be to collect in a single place extended
explanations and fix-it hints about gcc diagnostics. Perhaps in the future such
knowledge can be added to the compiler proper and enabled with a
-fdiagnostics-explain or -fdiagnostics-fix-it. 

I think this could be a killer-feature for GCC to have, but collecting the data
is a lot of work for a single person. This is a way to contribute to GCC
without writing a single line of code!


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

* [Bug c++/44499] No default constructor available
       [not found] <bug-44499-4@http.gcc.gnu.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2011-03-04 10:02 ` manu at gcc dot gnu.org
@ 2011-03-04 11:23 ` redi at gcc dot gnu.org
  2011-03-04 11:25 ` redi at gcc dot gnu.org
                   ` (7 subsequent siblings)
  12 siblings, 0 replies; 23+ messages in thread
From: redi at gcc dot gnu.org @ 2011-03-04 11:23 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #14 from Jonathan Wakely <redi at gcc dot gnu.org> 2011-03-04 11:23:41 UTC ---
(In reply to comment #13)
> (In reply to comment #12)
> > Manu, can we close this?
> 
> @Jonathan
> 
> I still think that the messages of Comeau and Clang are better than GCC's. I
> will try for 4.7 to produce a patch to change the message to be like:
> 
> error: default initialization of const object 'g_d' requires a user-provided
> default constructor [-fpermissive]
> note: 'const class D' has no user-provided default constructor
> 
> Do you agree? 

Sure, if you still plan to improve it let's definitely keep it open.

> (I'd like to keep the note to jump to the declaration of class D).

Ah yes, that's useful.

In the spirit of providing "fix it" hints, I think the EDG diagnostic is
better.  There are two ways to avoid the error:

1) Add a default constructor.  This changes the type in non-trivial ways with
potentially large side-effects in terms of POD-ness, affecting all users of the
code and requiring recompilation. It's not even possible for classes defined in
third-party headers.

2) Use an initializer.  This doesn't change the type and is a purely local
change.

The second option is probably the right one in most cases  :)
"Expert" users who know what they're doing can choose to alter the class, but I
don't think we should suggest they do so.

How about this:

error: Const object 'g_d' requires an initializer [-fpermissive]
note: 'const class D' has no user-provided default constructor

The error refers to the variable's location and says an initializer is needed.
The note refers to the class' location  and says it has no default constructor.


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

* [Bug c++/44499] No default constructor available
       [not found] <bug-44499-4@http.gcc.gnu.org/bugzilla/>
                   ` (4 preceding siblings ...)
  2011-03-04 11:23 ` redi at gcc dot gnu.org
@ 2011-03-04 11:25 ` redi at gcc dot gnu.org
  2011-03-17 11:46 ` dirtyepic at gentoo dot org
                   ` (6 subsequent siblings)
  12 siblings, 0 replies; 23+ messages in thread
From: redi at gcc dot gnu.org @ 2011-03-04 11:25 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |diagnostic
           Severity|normal                      |enhancement

--- Comment #15 from Jonathan Wakely <redi at gcc dot gnu.org> 2011-03-04 11:25:01 UTC ---
changing Severity and Keywords to clarify the outstanding work is just a
diagnostic enhancement


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

* [Bug c++/44499] No default constructor available
       [not found] <bug-44499-4@http.gcc.gnu.org/bugzilla/>
                   ` (6 preceding siblings ...)
  2011-03-17 11:46 ` dirtyepic at gentoo dot org
@ 2011-03-17 11:46 ` redi at gcc dot gnu.org
  2011-03-19 20:05 ` redi at gcc dot gnu.org
                   ` (4 subsequent siblings)
  12 siblings, 0 replies; 23+ messages in thread
From: redi at gcc dot gnu.org @ 2011-03-17 11:46 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #17 from Jonathan Wakely <redi at gcc dot gnu.org> 2011-03-17 11:45:35 UTC ---
(In reply to comment #16)
> (In reply to comment #11)
> > GCC 4.4 and 4.5 reject the example too, so I don't know when the bug was fixed,
> > it's apparently not a change in 4.6 (though there were some bugs in this area
> > fixed recently.)
> 
> Hmm, that particular example does fail.  But we've still been seeing this in
> packages such as xulrunner and openjade that are fine with 4.5, so some
> variation of the example is a new error.  eg. this only fails with 4.6:
> 
>   struct A { int a; A (); };
>   struct B : public A { };
>   const B b;

Yup, that fails with 4.6, as it should. It's also rejected by EDG and Clang,
but not VC++

OK, I'll update the changes page with a variation of the note in comment 11,
but upstream should still read the standard and deal with it ;)


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

* [Bug c++/44499] No default constructor available
       [not found] <bug-44499-4@http.gcc.gnu.org/bugzilla/>
                   ` (5 preceding siblings ...)
  2011-03-04 11:25 ` redi at gcc dot gnu.org
@ 2011-03-17 11:46 ` dirtyepic at gentoo dot org
  2011-03-17 11:46 ` redi at gcc dot gnu.org
                   ` (5 subsequent siblings)
  12 siblings, 0 replies; 23+ messages in thread
From: dirtyepic at gentoo dot org @ 2011-03-17 11:46 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #16 from Ryan Hill <dirtyepic at gentoo dot org> 2011-03-17 11:36:15 UTC ---
(In reply to comment #11)
> GCC 4.4 and 4.5 reject the example too, so I don't know when the bug was fixed,
> it's apparently not a change in 4.6 (though there were some bugs in this area
> fixed recently.)

Hmm, that particular example does fail.  But we've still been seeing this in
packages such as xulrunner and openjade that are fine with 4.5, so some
variation of the example is a new error.  eg. this only fails with 4.6:

  struct A { int a; A (); };
  struct B : public A { };
  const B b;


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

* [Bug c++/44499] No default constructor available
       [not found] <bug-44499-4@http.gcc.gnu.org/bugzilla/>
                   ` (7 preceding siblings ...)
  2011-03-17 11:46 ` redi at gcc dot gnu.org
@ 2011-03-19 20:05 ` redi at gcc dot gnu.org
  2011-09-25 11:46 ` [Bug c++/44499] [4.7 Regression?] " paolo.carlini at oracle dot com
                   ` (3 subsequent siblings)
  12 siblings, 0 replies; 23+ messages in thread
From: redi at gcc dot gnu.org @ 2011-03-19 20:05 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #18 from Jonathan Wakely <redi at gcc dot gnu.org> 2011-03-19 19:56:49 UTC ---
(In reply to comment #17)
> OK, I'll update the changes page with a variation of the note in comment 11,

done


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

* [Bug c++/44499] [4.7 Regression?] No default constructor available
       [not found] <bug-44499-4@http.gcc.gnu.org/bugzilla/>
                   ` (8 preceding siblings ...)
  2011-03-19 20:05 ` redi at gcc dot gnu.org
@ 2011-09-25 11:46 ` paolo.carlini at oracle dot com
  2011-09-25 14:23 ` redi at gcc dot gnu.org
                   ` (2 subsequent siblings)
  12 siblings, 0 replies; 23+ messages in thread
From: paolo.carlini at oracle dot com @ 2011-09-25 11:46 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jason at gcc dot gnu.org,
                   |                            |paolo.carlini at oracle dot
                   |                            |com
            Summary|No default constructor      |[4.7 Regression?] No
                   |available                   |default constructor
                   |                            |available

--- Comment #19 from Paolo Carlini <paolo.carlini at oracle dot com> 2011-09-25 11:41:02 UTC ---
In mainline this is accepted again! Is it a regression?


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

* [Bug c++/44499] [4.7 Regression?] No default constructor available
       [not found] <bug-44499-4@http.gcc.gnu.org/bugzilla/>
                   ` (9 preceding siblings ...)
  2011-09-25 11:46 ` [Bug c++/44499] [4.7 Regression?] " paolo.carlini at oracle dot com
@ 2011-09-25 14:23 ` redi at gcc dot gnu.org
  2011-09-25 14:39 ` [Bug c++/44499] " paolo.carlini at oracle dot com
  2014-02-16 10:02 ` jackie.rosen at hushmail dot com
  12 siblings, 0 replies; 23+ messages in thread
From: redi at gcc dot gnu.org @ 2011-09-25 14:23 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #20 from Jonathan Wakely <redi at gcc dot gnu.org> 2011-09-25 13:57:13 UTC ---
Probably this change:

2011-09-23  Jason Merrill  <jason@redhat.com>

        Core 253 - allow const objects with no initializer or
        user-provided default constructor if the defaulted constructor
        initializes all the subobjects.
        PR c++/20039
        PR c++/42844
        * class.c (default_init_uninitialized_part): New.
        * cp-tree.h: Declare it.
        * decl.c (check_for_uninitialized_const_var): Use it.
        * init.c (perform_member_init): Likewise.
        (build_new_1): Likewise.
        * method.c (walk_field_subobs): Likewise.


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

* [Bug c++/44499] No default constructor available
       [not found] <bug-44499-4@http.gcc.gnu.org/bugzilla/>
                   ` (10 preceding siblings ...)
  2011-09-25 14:23 ` redi at gcc dot gnu.org
@ 2011-09-25 14:39 ` paolo.carlini at oracle dot com
  2014-02-16 10:02 ` jackie.rosen at hushmail dot com
  12 siblings, 0 replies; 23+ messages in thread
From: paolo.carlini at oracle dot com @ 2011-09-25 14:39 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |WORKSFORME
   Target Milestone|---                         |4.7.0
            Summary|[4.7 Regression?] No        |No default constructor
                   |default constructor         |available
                   |available                   |

--- Comment #21 from Paolo Carlini <paolo.carlini at oracle dot com> 2011-09-25 14:11:52 UTC ---
Oh, indeed. Then I guess this can be simply closed for 4.7.0, the diagnostic
issue is now moot.


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

* [Bug c++/44499] No default constructor available
       [not found] <bug-44499-4@http.gcc.gnu.org/bugzilla/>
                   ` (11 preceding siblings ...)
  2011-09-25 14:39 ` [Bug c++/44499] " paolo.carlini at oracle dot com
@ 2014-02-16 10:02 ` jackie.rosen at hushmail dot com
  12 siblings, 0 replies; 23+ messages in thread
From: jackie.rosen at hushmail dot com @ 2014-02-16 10:02 UTC (permalink / raw)
  To: gcc-bugs

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

Jackie Rosen <jackie.rosen at hushmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jackie.rosen at hushmail dot com

--- Comment #22 from Jackie Rosen <jackie.rosen at hushmail dot com> ---
*** Bug 260998 has been marked as a duplicate of this bug. ***
Seen from the domain http://volichat.com
Marked for reference. Resolved as fixed @bugzilla.


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

* [Bug c++/44499] No default constructor available
  2010-06-11  9:10 [Bug c++/44499] New: " piotr dot wyderski at gmail dot com
                   ` (8 preceding siblings ...)
  2010-07-02  8:12 ` pluto at agmk dot net
@ 2010-07-02  9:15 ` manu at gcc dot gnu dot org
  9 siblings, 0 replies; 23+ messages in thread
From: manu at gcc dot gnu dot org @ 2010-07-02  9:15 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from manu at gcc dot gnu dot org  2010-07-02 09:15 -------
Thanks Pawel,

which diagnostic do you prefer? 

I would favor clang's but I would still keep the note that points to the class
definition.


-- 


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


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

* [Bug c++/44499] No default constructor available
  2010-06-11  9:10 [Bug c++/44499] New: " piotr dot wyderski at gmail dot com
                   ` (7 preceding siblings ...)
  2010-07-02  8:09 ` manu at gcc dot gnu dot org
@ 2010-07-02  8:12 ` pluto at agmk dot net
  2010-07-02  9:15 ` manu at gcc dot gnu dot org
  9 siblings, 0 replies; 23+ messages in thread
From: pluto at agmk dot net @ 2010-07-02  8:12 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from pluto at agmk dot net  2010-07-02 08:12 -------
(In reply to comment #7)
> Could someone test what clang says here? Their diagnostics are generally better
> than g++.
> 

$ clang++ pr44499.cpp -c
pr44499.cpp:5:9: error: default initialization of an object of const type 'D
const' requires a user-provided default constructor
const D g_d;
        ^
1 error generated.


-- 


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


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

* [Bug c++/44499] No default constructor available
  2010-06-11  9:10 [Bug c++/44499] New: " piotr dot wyderski at gmail dot com
                   ` (6 preceding siblings ...)
  2010-06-11 11:14 ` manu at gcc dot gnu dot org
@ 2010-07-02  8:09 ` manu at gcc dot gnu dot org
  2010-07-02  8:12 ` pluto at agmk dot net
  2010-07-02  9:15 ` manu at gcc dot gnu dot org
  9 siblings, 0 replies; 23+ messages in thread
From: manu at gcc dot gnu dot org @ 2010-07-02  8:09 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from manu at gcc dot gnu dot org  2010-07-02 08:09 -------
Could someone test what clang says here? Their diagnostics are generally better
than g++.


-- 


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


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

* [Bug c++/44499] No default constructor available
  2010-06-11  9:10 [Bug c++/44499] New: " piotr dot wyderski at gmail dot com
                   ` (5 preceding siblings ...)
  2010-06-11 11:12 ` manu at gcc dot gnu dot org
@ 2010-06-11 11:14 ` manu at gcc dot gnu dot org
  2010-07-02  8:09 ` manu at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 23+ messages in thread
From: manu at gcc dot gnu dot org @ 2010-06-11 11:14 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from manu at gcc dot gnu dot org  2010-06-11 11:13 -------
LLVM is still using GCC in their demo, not Clang. So I cannot test their
output.


-- 


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


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

* [Bug c++/44499] No default constructor available
  2010-06-11  9:10 [Bug c++/44499] New: " piotr dot wyderski at gmail dot com
                   ` (3 preceding siblings ...)
  2010-06-11 11:01 ` piotr dot wyderski at gmail dot com
@ 2010-06-11 11:12 ` manu at gcc dot gnu dot org
  2010-06-11 11:12 ` manu at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 23+ messages in thread
From: manu at gcc dot gnu dot org @ 2010-06-11 11:12 UTC (permalink / raw)
  To: gcc-bugs



-- 

manu at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |manu at gcc dot gnu dot org
                   |dot org                     |
             Status|UNCONFIRMED                 |ASSIGNED
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2010-06-11 11:11:57
               date|                            |


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


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

* [Bug c++/44499] No default constructor available
  2010-06-11  9:10 [Bug c++/44499] New: " piotr dot wyderski at gmail dot com
                   ` (4 preceding siblings ...)
  2010-06-11 11:12 ` manu at gcc dot gnu dot org
@ 2010-06-11 11:12 ` manu at gcc dot gnu dot org
  2010-06-11 11:14 ` manu at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 23+ messages in thread
From: manu at gcc dot gnu dot org @ 2010-06-11 11:12 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from manu at gcc dot gnu dot org  2010-06-11 11:11 -------
Comeau C/C++ 4.3.10.1 (Oct  6 2008 11:28:09) for ONLINE_EVALUATION_BETA2
Copyright 1988-2008 Comeau Computing.  All rights reserved.
MODE:strict errors C++ C++0x_extensions

"ComeauTest.c", line 9: error: const variable "g_d" requires an initializer --
class
          "D" has no explicitly declared default constructor
      const D g_d;
                 ^

"ComeauTest.c", line 9: warning: variable "g_d" was declared but never
referenced
      const D g_d;
              ^

1 error detected in the compilation of "ComeauTest.c".


I think the error message of comeau is better (but our note is better). I will
write a patch.


-- 

manu at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |UNCONFIRMED
         Resolution|INVALID                     |


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


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

* [Bug c++/44499] No default constructor available
  2010-06-11  9:10 [Bug c++/44499] New: " piotr dot wyderski at gmail dot com
                   ` (2 preceding siblings ...)
  2010-06-11 10:53 ` manu at gcc dot gnu dot org
@ 2010-06-11 11:01 ` piotr dot wyderski at gmail dot com
  2010-06-11 11:12 ` manu at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 23+ messages in thread
From: piotr dot wyderski at gmail dot com @ 2010-06-11 11:01 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from piotr dot wyderski at gmail dot com  2010-06-11 11:01 -------
(In reply to comment #2)
> A question: apart from quoting chapter and verse from the standard (8.5
> [dcl.init], para 9 in C++03, para 6 in C++0x,) how could the diagnostic have
> been any clearer?
> 
> It indicates you can use -fpermissive to relax the warning, and it includes a
> note telling you the type has no user-provided default constructor, which is
> true.  Why would you assume this is a bug, when a developer has gone to the
> trouble of writing the note?

All the compilers I am aware of accept the aforementioned construction,
so I blindly assumed that 4.6 is wrong in issuing a warning. The note's
content was considered irrelevant, since no error was expected. But if
the behaviour is OK, then it is OK no matter what a surprise it turns out to
be.


-- 


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


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

* [Bug c++/44499] No default constructor available
  2010-06-11  9:10 [Bug c++/44499] New: " piotr dot wyderski at gmail dot com
  2010-06-11  9:26 ` [Bug c++/44499] " redi at gcc dot gnu dot org
  2010-06-11 10:28 ` redi at gcc dot gnu dot org
@ 2010-06-11 10:53 ` manu at gcc dot gnu dot org
  2010-06-11 11:01 ` piotr dot wyderski at gmail dot com
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 23+ messages in thread
From: manu at gcc dot gnu dot org @ 2010-06-11 10:53 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from manu at gcc dot gnu dot org  2010-06-11 10:53 -------
(In reply to comment #1)
> gcc is correct, accepting the code previously was a bug that was fixed recently
> 
> You need to provide an initializer for g_d

This sort of changes should be documented in the changes.html page or in
porting_to.html


-- 

manu at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |manu at gcc dot gnu dot org


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


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

* [Bug c++/44499] No default constructor available
  2010-06-11  9:10 [Bug c++/44499] New: " piotr dot wyderski at gmail dot com
  2010-06-11  9:26 ` [Bug c++/44499] " redi at gcc dot gnu dot org
@ 2010-06-11 10:28 ` redi at gcc dot gnu dot org
  2010-06-11 10:53 ` manu at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 23+ messages in thread
From: redi at gcc dot gnu dot org @ 2010-06-11 10:28 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from redi at gcc dot gnu dot org  2010-06-11 10:27 -------
A question: apart from quoting chapter and verse from the standard (8.5
[dcl.init], para 9 in C++03, para 6 in C++0x,) how could the diagnostic have
been any clearer?

It indicates you can use -fpermissive to relax the warning, and it includes a
note telling you the type has no user-provided default constructor, which is
true.  Why would you assume this is a bug, when a developer has gone to the
trouble of writing the note?


-- 


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


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

* [Bug c++/44499] No default constructor available
  2010-06-11  9:10 [Bug c++/44499] New: " piotr dot wyderski at gmail dot com
@ 2010-06-11  9:26 ` redi at gcc dot gnu dot org
  2010-06-11 10:28 ` redi at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 23+ messages in thread
From: redi at gcc dot gnu dot org @ 2010-06-11  9:26 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from redi at gcc dot gnu dot org  2010-06-11 09:26 -------
gcc is correct, accepting the code previously was a bug that was fixed recently

You need to provide an initializer for g_d


-- 

redi at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


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


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

end of thread, other threads:[~2014-02-16 10:02 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-44499-4@http.gcc.gnu.org/bugzilla/>
2011-03-03 22:28 ` [Bug c++/44499] No default constructor available dirtyepic at gentoo dot org
2011-03-03 23:14 ` redi at gcc dot gnu.org
2011-03-03 23:16 ` redi at gcc dot gnu.org
2011-03-04 10:02 ` manu at gcc dot gnu.org
2011-03-04 11:23 ` redi at gcc dot gnu.org
2011-03-04 11:25 ` redi at gcc dot gnu.org
2011-03-17 11:46 ` dirtyepic at gentoo dot org
2011-03-17 11:46 ` redi at gcc dot gnu.org
2011-03-19 20:05 ` redi at gcc dot gnu.org
2011-09-25 11:46 ` [Bug c++/44499] [4.7 Regression?] " paolo.carlini at oracle dot com
2011-09-25 14:23 ` redi at gcc dot gnu.org
2011-09-25 14:39 ` [Bug c++/44499] " paolo.carlini at oracle dot com
2014-02-16 10:02 ` jackie.rosen at hushmail dot com
2010-06-11  9:10 [Bug c++/44499] New: " piotr dot wyderski at gmail dot com
2010-06-11  9:26 ` [Bug c++/44499] " redi at gcc dot gnu dot org
2010-06-11 10:28 ` redi at gcc dot gnu dot org
2010-06-11 10:53 ` manu at gcc dot gnu dot org
2010-06-11 11:01 ` piotr dot wyderski at gmail dot com
2010-06-11 11:12 ` manu at gcc dot gnu dot org
2010-06-11 11:12 ` manu at gcc dot gnu dot org
2010-06-11 11:14 ` manu at gcc dot gnu dot org
2010-07-02  8:09 ` manu at gcc dot gnu dot org
2010-07-02  8:12 ` pluto at agmk dot net
2010-07-02  9:15 ` manu at gcc dot gnu dot org

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).