Closed Bug 1774336 Opened 3 years ago Closed 3 years ago

Make FileInfoManagerGuard's default constructor public for C++20

Categories

(Core :: Storage: IndexedDB, defect, P3)

defect

Tracking

()

RESOLVED FIXED
104 Branch
Tracking Status
firefox-esr91 --- wontfix
firefox-esr102 --- wontfix
firefox102 --- wontfix
firefox103 --- wontfix
firefox104 --- fixed

People

(Reporter: cpeterson, Assigned: cpeterson)

References

Details

Attachments

(1 file)

C++20 changes to direct initialization with initializer lists make FileInfoManagerGuard's default constructor inaccessible.

https://en.cppreference.com/w/cpp/language/direct_initialization

Example code:

class C {
  C() {}
};

class D {
  D() = default;  // like FileInfoManagerGuard
};

int main() {
  C c{};  // error in C++17 and C++20
  D d1;   // error in C++17 and C++20
  D d2{}; // OK in C++17, error in C++20. This is how FileInfoManagerGuard objects are initialized.
  return 0;
}

Example C++20 error in clang and gcc:

dom/indexedDB/ActorsParent.cpp:12131:21: error: calling a private constructor of class 'mozilla::dom::indexedDB::FileInfoManager<mozilla::dom::indexedDB::DatabaseFileManager>::FileInfoManagerGuard'
                    FileInfoManagerGuard{}, SafeRefPtrFromThis(), id,
                    ^
dom/indexedDB/FileInfoManager.h:92:5: note: implicitly declared private here
    FileInfoManagerGuard() = default;
    ^

C++20 changes to direct initialization with initializer lists make FileInfoManagerGuard's default constructor inaccessible.

https://en.cppreference.com/w/cpp/language/direct_initialization

dom/indexedDB/ActorsParent.cpp:12131:21: error: calling a private constructor of class 'mozilla::dom::indexedDB::FileInfoManager<mozilla::dom::indexedDB::DatabaseFileManager>::FileInfoManagerGuard'
FileInfoManagerGuard{}, SafeRefPtrFromThis(), id,
^
dom/indexedDB/FileInfoManager.h:92:5: note: implicitly declared private here
FileInfoManagerGuard() = default;
^

Severity: N/A → S4
Pushed by cpeterson@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/c3875c2b3246 Make FileInfoManagerGuard's default constructor public for C++20. r=saschanaz
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 104 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: