Bug 37465 - ctors never override virtual functions
Summary: ctors never override virtual functions
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.4.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: rejects-valid
Depends on:
Blocks:
 
Reported: 2008-09-10 18:02 UTC by Mike Stump
Modified: 2012-01-05 01:03 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Known to work: 4.6.3, 4.7.0
Known to fail: 3.3, 4.0.1, 4.3.0, 4.4.0
Last reconfirmed: 2008-09-14 04:54:06


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mike Stump 2008-09-10 18:02:43 UTC
class A {
 virtual int B() { return 0; }
};

class B: A {
 B() { }
};

gives an error, but should compile (as gross as it is).  I'm hoping there is a prohibition against it, but didn't find one.
Comment 1 Mike Stump 2008-09-10 18:28:23 UTC
radr://6202462
Comment 2 Andrew Pinski 2008-09-14 04:54:02 UTC
Confirmed, looks related to covariant returns.
Comment 3 Andrew Pinski 2008-09-14 04:54:06 UTC
Confirmed, looks related to covariant returns.
Comment 4 David Fang 2008-09-27 23:01:01 UTC
Ick.
Also fails 4.3.2, 4.0.1, 3.3.
Comment 5 Paolo Carlini 2012-01-05 01:03:19 UTC
Fixed.