[Bug c++/44499] No default constructor available

2014-02-16 Thread jackie.rosen at hushmail dot com
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.


[Bug c++/44499] No default constructor available

2011-09-25 Thread paolo.carlini at oracle dot com
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.


[Bug c++/44499] No default constructor available

2011-03-19 Thread redi at gcc dot gnu.org
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


[Bug c++/44499] No default constructor available

2011-03-17 Thread dirtyepic at gentoo dot org
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;


[Bug c++/44499] No default constructor available

2011-03-17 Thread redi at gcc dot gnu.org
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 ;)


[Bug c++/44499] No default constructor available

2011-03-04 Thread manu at gcc dot gnu.org
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!


[Bug c++/44499] No default constructor available

2011-03-04 Thread redi at gcc dot gnu.org
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.


[Bug c++/44499] No default constructor available

2011-03-04 Thread redi at gcc dot gnu.org
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


[Bug c++/44499] No default constructor available

2011-03-03 Thread dirtyepic at gentoo dot org
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.


[Bug c++/44499] No default constructor available

2011-03-03 Thread redi at gcc dot gnu.org
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:

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


[Bug c++/44499] No default constructor available

2011-03-03 Thread redi at gcc dot gnu.org
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?


[Bug c++/44499] No default constructor available

2010-07-02 Thread manu at gcc dot gnu dot org


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



[Bug c++/44499] No default constructor available

2010-07-02 Thread pluto at agmk dot net


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



[Bug c++/44499] No default constructor available

2010-07-02 Thread manu at gcc dot gnu dot org


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



[Bug c++/44499] No default constructor available

2010-06-11 Thread redi at gcc dot gnu dot org


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



[Bug c++/44499] No default constructor available

2010-06-11 Thread redi at gcc dot gnu dot org


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



[Bug c++/44499] No default constructor available

2010-06-11 Thread manu at gcc dot gnu dot org


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



[Bug c++/44499] No default constructor available

2010-06-11 Thread piotr dot wyderski at gmail dot com


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



[Bug c++/44499] No default constructor available

2010-06-11 Thread manu at gcc dot gnu dot org


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



[Bug c++/44499] No default constructor available

2010-06-11 Thread manu at gcc dot gnu dot org


-- 

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|-00-00 00:00:00 |2010-06-11 11:11:57
   date||


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



[Bug c++/44499] No default constructor available

2010-06-11 Thread manu at gcc dot gnu dot org


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