This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/44499] No default constructor available
- From: "redi at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 3 Mar 2011 23:14:17 +0000
- Subject: [Bug c++/44499] No default constructor available
- Auto-submitted: auto-generated
- References: <bug-44499-4@http.gcc.gnu.org/bugzilla/>
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.