public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/65300] New: If one more constructor is defined, default params on using not passed from parent class
@ 2015-03-03 15:42 webmatematika at hotmail dot com
  2015-03-03 16:39 ` [Bug c++/65300] " redi at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: webmatematika at hotmail dot com @ 2015-03-03 15:42 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 65300
           Summary: If one more constructor is defined, default params on
                    using not passed from parent class
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: webmatematika at hotmail dot com

Created attachment 34937
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=34937&action=edit
gcc t.cpp --std=c++11

I am wondering why class B compiles without problems, but class C shows errors
on c4 construction, as default arguments are not passed. If this is by
Standard, could you point me to that paragraph? Thank you for your time.

t.cpp: In function ‘int main()’:
t.cpp:24:4: error: no matching function for call to ‘C::C()’
  C c4;
    ^
t.cpp:24:4: note: candidates are:
t.cpp:13:12: note: C::C(int, int)
   using A::A;
            ^
t.cpp:13:12: note:   candidate expects 2 arguments, 0 provided
t.cpp:13:12: note: C::C(int)
t.cpp:13:12: note:   candidate expects 1 argument, 0 provided
t.cpp:14:3: note: C::C(int, int, int)
   C(int c1, int c2, int c3) : A(c1, c2) {}
   ^
t.cpp:14:3: note:   candidate expects 3 arguments, 0 provided
t.cpp:11:7: note: constexpr C::C(const C&)
 class C : public A {
       ^
t.cpp:11:7: note:   candidate expects 1 argument, 0 provided
t.cpp:11:7: note: constexpr C::C(C&&)
t.cpp:11:7: note:   candidate expects 1 argument, 0 provided
>From gcc-bugs-return-479177-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Tue Mar 03 15:55:53 2015
Return-Path: <gcc-bugs-return-479177-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 1648 invoked by alias); 3 Mar 2015 15:55:52 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 1585 invoked by uid 48); 3 Mar 2015 15:55:45 -0000
From: "law at redhat dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/65289] [5 regression] ICE when compiling libjpegturbo with -floop-nest-optimize
Date: Tue, 03 Mar 2015 15:55:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: middle-end
X-Bugzilla-Version: 5.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: major
X-Bugzilla-Who: law at redhat dot com
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Priority: P4
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: 5.0
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: priority cc
Message-ID: <bug-65289-4-CRLPTnqIBT@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-65289-4@http.gcc.gnu.org/bugzilla/>
References: <bug-65289-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2015-03/txt/msg00321.txt.bz2
Content-length: 446

https://gcc.gnu.org/bugzilla/show_bug.cgi?ide289

Jeffrey A. Law <law at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P4
                 CC|                            |law at redhat dot com

--- Comment #3 from Jeffrey A. Law <law at redhat dot com> ---
Graphite issue, thus P4.


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

* [Bug c++/65300] If one more constructor is defined, default params on using not passed from parent class
  2015-03-03 15:42 [Bug c++/65300] New: If one more constructor is defined, default params on using not passed from parent class webmatematika at hotmail dot com
@ 2015-03-03 16:39 ` redi at gcc dot gnu.org
  2015-03-03 16:41 ` redi at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: redi at gcc dot gnu.org @ 2015-03-03 16:39 UTC (permalink / raw)
  To: gcc-bugs

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

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> ---
This is the same as PR 65291, but I stated the reason wrong there.

Default constructors have special rules. A constructor like C(int = 0) or
C(int = 0, int = 0) will not declare a default constructor when inherited. You
need to declare it explicitly:

  C() = default;

See [class.inhctor] in the standard.


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

* [Bug c++/65300] If one more constructor is defined, default params on using not passed from parent class
  2015-03-03 15:42 [Bug c++/65300] New: If one more constructor is defined, default params on using not passed from parent class webmatematika at hotmail dot com
  2015-03-03 16:39 ` [Bug c++/65300] " redi at gcc dot gnu.org
@ 2015-03-03 16:41 ` redi at gcc dot gnu.org
  2015-03-03 16:50 ` redi at gcc dot gnu.org
  2015-03-03 17:31 ` webmatematika at hotmail dot com
  3 siblings, 0 replies; 5+ messages in thread
From: redi at gcc dot gnu.org @ 2015-03-03 16:41 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Sigh, I still got it wrong, sorry!

The default ctor is suppressed, because you declared:

  C(int c1, int c2, int c3) : A(c1, c2) {}

The solution is still to declare it explicitly:

  C() = default;


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

* [Bug c++/65300] If one more constructor is defined, default params on using not passed from parent class
  2015-03-03 15:42 [Bug c++/65300] New: If one more constructor is defined, default params on using not passed from parent class webmatematika at hotmail dot com
  2015-03-03 16:39 ` [Bug c++/65300] " redi at gcc dot gnu.org
  2015-03-03 16:41 ` redi at gcc dot gnu.org
@ 2015-03-03 16:50 ` redi at gcc dot gnu.org
  2015-03-03 17:31 ` webmatematika at hotmail dot com
  3 siblings, 0 replies; 5+ messages in thread
From: redi at gcc dot gnu.org @ 2015-03-03 16:50 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
[class.inhctor]/3:

For each non-template constructor in the candidate set of inherited
constructors other than a constructor having no parameters or a copy/move
constructor having a single parameter, a constructor is implicitly declared
with the same constructor characteristics unless there is a user-declared
constructor with the same
signature in the complete class where the using-declaration appears or the
constructor would be a default, copy, or move constructor for that class. 

So inheriting constructors can't declare default, copy or move constructors,
and the presence of another constructor in the class suppresses the implicit
declaration of a default constructor.


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

* [Bug c++/65300] If one more constructor is defined, default params on using not passed from parent class
  2015-03-03 15:42 [Bug c++/65300] New: If one more constructor is defined, default params on using not passed from parent class webmatematika at hotmail dot com
                   ` (2 preceding siblings ...)
  2015-03-03 16:50 ` redi at gcc dot gnu.org
@ 2015-03-03 17:31 ` webmatematika at hotmail dot com
  3 siblings, 0 replies; 5+ messages in thread
From: webmatematika at hotmail dot com @ 2015-03-03 17:31 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from webmatematika at hotmail dot com ---
Thanks for time and explanation.


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

end of thread, other threads:[~2015-03-03 17:31 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-03 15:42 [Bug c++/65300] New: If one more constructor is defined, default params on using not passed from parent class webmatematika at hotmail dot com
2015-03-03 16:39 ` [Bug c++/65300] " redi at gcc dot gnu.org
2015-03-03 16:41 ` redi at gcc dot gnu.org
2015-03-03 16:50 ` redi at gcc dot gnu.org
2015-03-03 17:31 ` webmatematika at hotmail 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).