Closed Bug 1554989 Opened 5 years ago Closed 5 years ago

Inheriting constructors whose inherited constructors are implicit are always rejected

Categories

(Developer Infrastructure :: Source Code Analysis, defect)

defect
Not set
normal

Tracking

(firefox-esr60 fixed, firefox-esr68 fixed, firefox69 fixed)

RESOLVED FIXED
mozilla69
Tracking Status
firefox-esr60 --- fixed
firefox-esr68 --- fixed
firefox69 --- fixed

People

(Reporter: ytausky, Assigned: ytausky)

References

Details

Attachments

(2 files)

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.

Yaron it would really help if you could provide an example here.

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.

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
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla69
Assignee: nobody → ytausky

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.

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:
Attachment #9088121 - Flags: approval-mozilla-esr68?

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.

Attachment #9088121 - Flags: approval-mozilla-esr68? → approval-mozilla-esr68+

Comment on attachment 9088121 [details]
Bug 1554989 - Fix implicit checker on inheriting constructors r=andi

this is also needed on esr60

Attachment #9088121 - Flags: approval-mozilla-esr60+
Product: Firefox Build System → Developer Infrastructure
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: