public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/65652] New: defaulted default constructor
@ 2015-04-01 12:44 wolfgang.roehrl@gi-de.com
  2015-04-01 13:11 ` [Bug c++/65652] " redi at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: wolfgang.roehrl@gi-de.com @ 2015-04-01 12:44 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65652

            Bug ID: 65652
           Summary: defaulted default constructor
           Product: gcc
           Version: 4.8.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: wolfgang.roehrl@gi-de.com

Hi,

I would like to post a bug report for the GNU C/C++ compiler 4.8.3.

We use the compiler to generate code for a PowerPC processor.

Invokation line for the GNU C++ compiler:

ccppc -c -x c++ -std=c++11 -Wall -Werror -g -mcpu=8540 -meabi
      -ftls-model=local-exec -msdata=sysv -fno-common -mspe -mabi=spe
      -mfloat-gprs=double -mbig -mmultiple -mno-string -misel -mstrict-align
      -fverbose-asm -fno-exceptions -fno-rtti -fgcse-sm -fno-section-anchors
      -ftemplate-backtrace-limit=20 -G 8 -O3
      -I<some include paths>
      -D<some #define's>
      X.CPP -oX.O


// file X.CPP

struct S
{
//  S () = default;

    S (const S&) = delete;
    S& operator= (const S&) = delete;
};

S x;


The compiler rejects this programm with the following message:
x.CPP:9:3: error: no matching function for call to 'S::S()'
 S x;
   ^
x.CPP:9:3: note: candidate is:
x.CPP:5:5: note: S::S(const S&) <deleted>
     S (const S&) = delete;
     ^
x.CPP:5:5: note:   candidate expects 1 argument, 0 provided


I think this is not standard conforming. The C++11 standard, 12.1/5 says:
"If there is no user-declared constructor for class X, a constructor having
no parameters is implicitly declared as defaulted (8.4)." I don't think that
"S (const S&) = delete;" should be counted as a user-declared constructor.

Notes:
. If line 3 is uncommented the compiler accepts the programm.
. IF line 5 is commented out the compiler accepts the programm.


With kind regards
W. Roehrl


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

* [Bug c++/65652] defaulted default constructor
  2015-04-01 12:44 [Bug c++/65652] New: defaulted default constructor wolfgang.roehrl@gi-de.com
@ 2015-04-01 13:11 ` redi at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: redi at gcc dot gnu.org @ 2015-04-01 13:11 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65652

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

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

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Wolfgang Roehrl from comment #0)
> I don't think that
> "S (const S&) = delete;" should be counted as a user-declared constructor.

You declared the constructor, and you defined it as deleted.

But that still means you declared it.


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

end of thread, other threads:[~2015-04-01 13:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-01 12:44 [Bug c++/65652] New: defaulted default constructor wolfgang.roehrl@gi-de.com
2015-04-01 13:11 ` [Bug c++/65652] " redi at gcc dot gnu.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).