public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/65291] New: protected using constructor default arguments not recognized
@ 2015-03-03  5:17 webmatematika at hotmail dot com
  2015-03-03  5:26 ` [Bug c++/65291] " webmatematika at hotmail dot com
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: webmatematika at hotmail dot com @ 2015-03-03  5:17 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 65291
           Summary: protected using constructor default arguments not
                    recognized
           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 34931
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=34931&action=edit
Classes A and B, and main file c.cpp

using A::A in class B that inherits class A should allow us to construct B with
same number of arguments as class A.


run with gcc c.cpp -std=c++11
Tested with gcc 4.8.2, but I think it's active in 4.9 too.


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

* [Bug c++/65291] protected using constructor default arguments not recognized
  2015-03-03  5:17 [Bug c++/65291] New: protected using constructor default arguments not recognized webmatematika at hotmail dot com
@ 2015-03-03  5:26 ` webmatematika at hotmail dot com
  2015-03-03 12:51 ` [Bug c++/65291] mention that default arguments of constructors are not inherited manu at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: webmatematika at hotmail dot com @ 2015-03-03  5:26 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="UTF-8", Size: 5222 bytes --]

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

--- Comment #1 from webmatematika at hotmail dot com ---
Here is compile error output:  

(I added in c.cpp line 4 "public:" in class C)





voja@vojaws:~/coding$ gcc c.cpp -std=c++11
c.cpp: In constructor ‘C::C()’:
c.cpp:5:11: error: no matching function for call to ‘B::B()’
   C() : B() {}
           ^
c.cpp:5:11: note: candidates are:
In file included from c.cpp:1:0:
b.h:7:12: note: B::B(int)
   using A::A;
            ^
b.h:7:12: note:   candidate expects 1 argument, 0 provided
b.h:5:3: note: B::B(int, int)
   B(int b1, int b2) : A(b1) {}
   ^
b.h:5:3: note:   candidate expects 2 arguments, 0 provided
b.h:3:7: note: constexpr B::B(const B&)
 class B : public A {
       ^
b.h:3:7: note:   candidate expects 1 argument, 0 provided
b.h:3:7: note: constexpr B::B(B&&)
b.h:3:7: note:   candidate expects 1 argument, 0 provided
>From gcc-bugs-return-479100-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Tue Mar 03 05:48:40 2015
Return-Path: <gcc-bugs-return-479100-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 14246 invoked by alias); 3 Mar 2015 05:48:40 -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 14229 invoked by uid 48); 3 Mar 2015 05:48:37 -0000
From: "raj.khem at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/65292] New: Template function not emitted
Date: Tue, 03 Mar 2015 05:48:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: new
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: c++
X-Bugzilla-Version: 5.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: raj.khem at gmail dot com
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter attachments.created
Message-ID: <bug-65292-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/msg00244.txt.bz2
Content-length: 2494

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

            Bug ID: 65292
           Summary: Template function not emitted
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: raj.khem at gmail dot com

Created attachment 34932
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id4932&actioníit
testcase

Attached code from webkit, shows that when compiling it for arm with gcc -O2, a
function goes missing in the object file

   case NonArrayWithInt32: case ArrayWithInt32: {
        putByIndexBeyondVectorLengthWithoutAttributes<Int32Shape>(exec, i,
value);
        break;
    }

    case NonArrayWithDouble: case ArrayWithDouble: {
        putByIndexBeyondVectorLengthWithoutAttributes<DoubleShape>(exec, i,
value);
        break;
    }

    case NonArrayWithContiguous: case ArrayWithContiguous: {
        putByIndexBeyondVectorLengthWithoutAttributes<ContiguousShape>(exec, i,
value);
        break;
    }

Out of those calls, putByIndexBeyondVectorLengthWithoutAttributes<Int32Shape>
is not emitted into .s file, when compiled with -O1 the function is emitted


This problem is not happening on 4.8.x or 4.9.x

gcc-5.0 - O2
=============
readelf -sW JSObject.o | c++filt | grep
putByIndexBeyondVectorLengthWithoutAttributes
   298: 00000000   284 FUNC    WEAK   HIDDEN    43 void
JSC::JSObject::putByIndexBeyondVectorLengthWithoutAttributes<(unsigned
char)22>(JSC::ExecState*, unsigned int, JSC::JSValue)
   300: 00000000   264 FUNC    WEAK   HIDDEN    45 void
JSC::JSObject::putByIndexBeyondVectorLengthWithoutAttributes<(unsigned
char)26>(JSC::ExecState*, unsigned int, JSC::JSValue)

gcc-5.0 - O1
===========
readelf -sW a.o | c++filt | grep putByIndexBeyondVectorLengthWithoutAttributes
   505: 00000000   224 FUNC    WEAK   DEFAULT  128 void
JSC::JSObject::putByIndexBeyondVectorLengthWithoutAttributes<(unsigned
char)20>(JSC::ExecState*, unsigned int, JSC::JSValue)
   507: 00000000   252 FUNC    WEAK   DEFAULT  138 void
JSC::JSObject::putByIndexBeyondVectorLengthWithoutAttributes<(unsigned
char)22>(JSC::ExecState*, unsigned int, JSC::JSValue)
   510: 00000000   224 FUNC    WEAK   DEFAULT  147 void
JSC::JSObject::putByIndexBeyondVectorLengthWithoutAttributes<(unsigned
char)26>(JSC::ExecState*, unsigned int, JSC::JSValue)


version I am at is gcc version 5.0.0 20150301 (experimental) (GCC)


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

* [Bug c++/65291] mention that default arguments of constructors are not inherited
  2015-03-03  5:17 [Bug c++/65291] New: protected using constructor default arguments not recognized webmatematika at hotmail dot com
  2015-03-03  5:26 ` [Bug c++/65291] " webmatematika at hotmail dot com
@ 2015-03-03 12:51 ` manu at gcc dot gnu.org
  2015-03-03 14:26 ` redi at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: manu at gcc dot gnu.org @ 2015-03-03 12:51 UTC (permalink / raw)
  To: gcc-bugs

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

Manuel López-Ibáñez <manu at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
   Last reconfirmed|                            |2015-03-03
                 CC|                            |manu at gcc dot gnu.org
         Resolution|INVALID                     |---
            Summary|protected using constructor |mention that default
                   |default arguments not       |arguments of constructors
                   |recognized                  |are not inherited
     Ever confirmed|0                           |1

--- Comment #3 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
(In reply to Jonathan Wakely from comment #2)
> The C++ standard says that B inherits a constructor taking a single int, the
> default argument is not inherited, so B has no default constructor, and G++
> is correct to reject the program.

This is the key information. Couldn't g++ say something like?

b.h:7:12: note: B::B(int)
   using A::A;
            ^
b.h:7:12: note:   candidate expects 1 argument, 0 provided (default arguments
are not inherited)

BTW, clang rejects the 'using':

10 : error: using declaration cannot refer to a constructor
>From gcc-bugs-return-479153-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Tue Mar 03 13:05:29 2015
Return-Path: <gcc-bugs-return-479153-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 39611 invoked by alias); 3 Mar 2015 13:05:28 -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 39523 invoked by uid 48); 3 Mar 2015 13:05:21 -0000
From: "mpolacek at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/65297] [5 Regression] ICE (in get_untransformed_body, at cgraph.c:3113) on arm-linux-gnueabihf
Date: Tue, 03 Mar 2015 13:05:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: target
X-Bugzilla-Version: 5.0
X-Bugzilla-Keywords: ice-on-valid-code
X-Bugzilla-Severity: normal
X-Bugzilla-Who: mpolacek at gcc dot gnu.org
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: cc
Message-ID: <bug-65297-4-Y5rwtqdzGV@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-65297-4@http.gcc.gnu.org/bugzilla/>
References: <bug-65297-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/msg00297.txt.bz2
Content-length: 425

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mpolacek at gcc dot gnu.org

--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
This might be already fixed in r221134.


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

* [Bug c++/65291] mention that default arguments of constructors are not inherited
  2015-03-03  5:17 [Bug c++/65291] New: protected using constructor default arguments not recognized webmatematika at hotmail dot com
  2015-03-03  5:26 ` [Bug c++/65291] " webmatematika at hotmail dot com
  2015-03-03 12:51 ` [Bug c++/65291] mention that default arguments of constructors are not inherited manu at gcc dot gnu.org
@ 2015-03-03 14:26 ` redi at gcc dot gnu.org
  2015-03-03 16:43 ` redi at gcc dot gnu.org
  2015-03-03 16:55 ` redi at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: redi at gcc dot gnu.org @ 2015-03-03 14:26 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Manuel López-Ibáñez from comment #3)
> BTW, clang rejects the 'using':
> 
> 10 : error: using declaration cannot refer to a constructor

You need to compile as C++11.
>From gcc-bugs-return-479164-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Tue Mar 03 14:32:12 2015
Return-Path: <gcc-bugs-return-479164-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 114251 invoked by alias); 3 Mar 2015 14:32:11 -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 114186 invoked by uid 48); 3 Mar 2015 14:32:08 -0000
From: "redi at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/65291] mention that default arguments of constructors are not inherited
Date: Tue, 03 Mar 2015 14:32:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: c++
X-Bugzilla-Version: unknown
X-Bugzilla-Keywords: diagnostic
X-Bugzilla-Severity: normal
X-Bugzilla-Who: redi at gcc dot gnu.org
X-Bugzilla-Status: REOPENED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: keywords
Message-ID: <bug-65291-4-F8UtVWKw6R@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-65291-4@http.gcc.gnu.org/bugzilla/>
References: <bug-65291-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/msg00308.txt.bz2
Content-length: 878

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |diagnostic

--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Reduced:

struct A {
  A(int a = 0) { }
};

struct B : A {
  using A::A;
  B(int, int);
};

B b;


FWIW the relevant output from Clang trunk is:

c.cc:10:3: error: no matching constructor for initialization of 'B'
B b;
  ^
c.cc:6:12: note: candidate constructor (inherited) not viable: requires 1
argument, but 0 were provided
  using A::A;
           ^
c.cc:2:3: note: inherited from here
  A(int a = 0) { }
  ^


EDG says simply:

"c.cc", line 10: error: no default constructor exists for class "B"
  B b;
    ^


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

* [Bug c++/65291] mention that default arguments of constructors are not inherited
  2015-03-03  5:17 [Bug c++/65291] New: protected using constructor default arguments not recognized webmatematika at hotmail dot com
                   ` (2 preceding siblings ...)
  2015-03-03 14:26 ` redi at gcc dot gnu.org
@ 2015-03-03 16:43 ` redi at gcc dot gnu.org
  2015-03-03 16:55 ` redi at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: redi at gcc dot gnu.org @ 2015-03-03 16:43 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #6 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Actually, I got the reason wrong. Default args are inherited, but the presence
of this constructor suppresses the default ctor B():

  B(int b1, int b2) : A(b1) {}

So we don't want to add a diagnostic about inheriting default arguments.


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

* [Bug c++/65291] mention that default arguments of constructors are not inherited
  2015-03-03  5:17 [Bug c++/65291] New: protected using constructor default arguments not recognized webmatematika at hotmail dot com
                   ` (3 preceding siblings ...)
  2015-03-03 16:43 ` redi at gcc dot gnu.org
@ 2015-03-03 16:55 ` redi at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: redi at gcc dot gnu.org @ 2015-03-03 16:55 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from Jonathan Wakely <redi at gcc dot gnu.org> ---
We could potentially add a note saying that the default constructor is
suppressed by the presence of another user-declared constructor, but that's
unrelated to inheriting constructors, and should be a separate bug to avoid the
confusing history here (which is my fault).


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

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

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-03  5:17 [Bug c++/65291] New: protected using constructor default arguments not recognized webmatematika at hotmail dot com
2015-03-03  5:26 ` [Bug c++/65291] " webmatematika at hotmail dot com
2015-03-03 12:51 ` [Bug c++/65291] mention that default arguments of constructors are not inherited manu at gcc dot gnu.org
2015-03-03 14:26 ` redi at gcc dot gnu.org
2015-03-03 16:43 ` redi at gcc dot gnu.org
2015-03-03 16:55 ` 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).