Inheriting constructors whose inherited constructors are implicit are always rejected
Categories
(Developer Infrastructure :: Source Code Analysis, defect)
Tracking
(firefox-esr60 fixed, firefox-esr68 fixed, firefox69 fixed)
People
(Reporter: ytausky, Assigned: ytausky)
References
Details
Attachments
(2 files)
47 bytes,
text/x-phabricator-request
|
Details | Review | |
47 bytes,
text/x-phabricator-request
|
jcristau
:
approval-mozilla-esr60+
RyanVM
:
approval-mozilla-esr68+
|
Details | Review |
The matcher checks the inherited constructors for implicitness but the introducing declaration for the MOZ_IMPLICIT
annotation. Since a using-declaration cannot have attributes, such constructors are always rejected.
Comment 1•5 years ago
|
||
Yaron it would really help if you could provide an example here.
Assignee | ||
Comment 2•5 years ago
|
||
Sure:
class A {
public:
MOZ_IMPLICIT A(int) {}
};
class B : public A {
public:
using A::A;
};
The using A::A;
declaration introduces an implicit constructor, but there's no way to mark it as intended, as far as I can tell.
Assignee | ||
Comment 3•5 years ago
|
||
Inheriting constructors are implicitly introduced via a using-declaration.
Since the C++ grammar doesn't allow attributes on using-declarations, it
is currently impossible to add MOZ_IMPLICIT to implicit inheriting
constructors.
This commit changes the AST matcher such that it ignores inheriting
constructors altogether. If they are inheriting from an implicit inherited
constructor, that constructor's check should be enough to ensure that no
constructors are unintentionally implicit.
Pushed by ytausky@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/f99b54a6da93 Fix implicit checker on inheriting constructors r=andi
Comment 5•5 years ago
|
||
bugherder |
Updated•5 years ago
|
Assignee | ||
Comment 6•5 years ago
|
||
Inheriting constructors are implicitly introduced via a using-declaration.
Since the C++ grammar doesn't allow attributes on using-declarations, it
is currently impossible to add MOZ_IMPLICIT to implicit inheriting
constructors.
This commit changes the AST matcher such that it ignores inheriting
constructors altogether. If they are inheriting from an implicit inherited
constructor, that constructor's check should be enough to ensure that no
constructors are unintentionally implicit.
Assignee | ||
Comment 7•5 years ago
|
||
Comment on attachment 9088121 [details]
Bug 1554989 - Fix implicit checker on inheriting constructors r=andi
ESR Uplift Approval Request
- If this is not a sec:{high,crit} bug, please state case for ESR consideration: This bug fix is required in order to land another important patch.
- User impact if declined: Inability to land an important patch due to static analysis error.
- Fix Landed on Version: 69
- Risk to taking this patch: Low
- Why is the change risky/not risky? (and alternatives if risky): This patch only changes the static analysis check and none of the user-visible code.
- String or UUID changes made by this patch:
Comment 8•5 years ago
|
||
Comment on attachment 9088121 [details]
Bug 1554989 - Fix implicit checker on inheriting constructors r=andi
Bustage fix for another patch being uplifted. Approved for 68.1esr.
Comment 9•5 years ago
|
||
bugherder uplift |
Updated•5 years ago
|
Comment 10•5 years ago
|
||
Comment on attachment 9088121 [details]
Bug 1554989 - Fix implicit checker on inheriting constructors r=andi
this is also needed on esr60
Comment 11•5 years ago
|
||
uplift |
Updated•2 years ago
|
Description
•