Closed Bug 1775162 Opened 2 years ago Closed 2 years ago

Fix C++20 build error in BSPPolygon template class definition

Categories

(Core :: Graphics: Layers, defect, P3)

defect

Tracking

()

RESOLVED FIXED
103 Branch
Tracking Status
firefox-esr91 --- wontfix
firefox-esr102 --- wontfix
firefox101 --- wontfix
firefox102 --- wontfix
firefox103 --- fixed

People

(Reporter: cpeterson, Assigned: cpeterson)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

gcc -std=c++20 (but not clang -std=c++20) complains about template class definitions that specify the template parameter on the class constructor. For example:

template <typename T>
class C {
  C(int x) {}
  // OK in clang and gcc for both -std=c++17 and -std=c++20.

  C<T>(int x, int y) {}
  // OK in clang for both -std=c++17 and -std=c++20.
  // OK in gcc -std=c++17 but a build error with -std=c++20.
};

The BSPPolygon build error:

In file included from /builds/worker/workspace/obj-build/dist/include/nsDisplayList.h:43,
from /builds/worker/workspace/obj-build/dist/include/mozilla/layout/RemoteLayerTreeOwner.h:17,
from /builds/worker/workspace/obj-build/dist/include/mozilla/dom/BrowserParent.h:23,
from /builds/worker/checkouts/gecko/accessible/ipc/other/RemoteAccessible.cpp:13:
/builds/worker/workspace/obj-build/dist/include/mozilla/layers/BSPTree.h:30:18: error: expected ')' before '*' token
|   BSPPolygon<T>(T* aData, gfx::Polygon&& aGeometry)
|                ~ ^

gcc -std=c++20 (but not clang -std=c++20) complains about template class definitions that specify the template parameter on the class constructor.

In file included from /builds/worker/workspace/obj-build/dist/include/nsDisplayList.h:43,
from /builds/worker/workspace/obj-build/dist/include/mozilla/layout/RemoteLayerTreeOwner.h:17,
from /builds/worker/workspace/obj-build/dist/include/mozilla/dom/BrowserParent.h:23,
from /builds/worker/checkouts/gecko/accessible/ipc/other/RemoteAccessible.cpp:13:
/builds/worker/workspace/obj-build/dist/include/mozilla/layers/BSPTree.h:30:18: error: expected ')' before '' token
| BSPPolygon<T>(T
aData, gfx::Polygon&& aGeometry)
| ~ ^

Pushed by cpeterson@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/ed6630bb5d50
Fix C++20 build error in BSPPolygon template class definition. r=gfx-reviewers,jrmuizel
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 103 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: