Closed Bug 1771932 Opened 3 years ago Closed 3 years ago

src/glsl.h:2315:29: error: call to non-'constexpr' function 'glsl::vec2& glsl::vec2::operator=(glsl::vec2&&)'

Categories

(Core :: Graphics: WebRender, defect)

Firefox 91
defect

Tracking

()

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

People

(Reporter: petr.sumbera, Assigned: lsalzman)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

Steps to reproduce:

Firefox 91.9.0 build fails when GCC 12.1.0 is used. GCC 11 works ok:

[swgl 0.1.0] cargo:warning=src/glsl.h: In constructor 'constexpr glsl::mat2::mat2(glsl::mat2_scalar)':
[swgl 0.1.0] cargo:warning=src/glsl.h:2315:29: error: call to non-'constexpr' function 'glsl::vec2& glsl::vec2::operator=(glsl::vec2&&)'
[swgl 0.1.0] cargo:warning= 2315 |     data[0] = vec2(s.data[0]);
[swgl 0.1.0] cargo:warning=      |                             ^
[swgl 0.1.0] cargo:warning=src/glsl.h:469:8: note: 'glsl::vec2& glsl::vec2::operator=(glsl::vec2&&)' is not usable as a 'constexpr' function because:
[swgl 0.1.0] cargo:warning=  469 | struct vec2 {
[swgl 0.1.0] cargo:warning=      |        ^~~~
[swgl 0.1.0] cargo:warning=In file included from src/glsl.h:7:
[swgl 0.1.0] cargo:warning=src/vector_type.h:266:15: note: defaulted constructor calls non-'constexpr' 'glsl::VectorType<T, N>& glsl::VectorType<T, N>::operator=(glsl::VectorType<T, N>) [with T = float; int N = 4]'
[swgl 0.1.0] cargo:warning=  266 |   VectorType& operator=(VectorType x) {
[swgl 0.1.0] cargo:warning=      |               ^~~~~~~~
[swgl 0.1.0] cargo:warning=src/vector_type.h:266:15: note: 'glsl::VectorType<T, N>& glsl::VectorType<T, N>::operator=(glsl::VectorType<T, N>) [with T = float; int N = 4]' declared here
[swgl 0.1.0] cargo:warning=src/vector_type.h:266:15: note: defaulted constructor calls non-'constexpr' 'glsl::VectorType<T, N>& glsl::VectorType<T, N>::operator=(glsl::VectorType<T, N>) [with T = float; int N = 4]'
[swgl 0.1.0] cargo:warning=src/vector_type.h:266:15: note: 'glsl::VectorType<T, N>& glsl::VectorType<T, N>::operator=(glsl::VectorType<T, N>) [with T = float; int N = 4]' declared here
[swgl 0.1.0] cargo:warning=src/glsl.h: At global scope:
[swgl 0.1.0] cargo:warning=src/glsl.h:2368:46: warning: 'annotate' attribute directive ignored [-Wattributes]
[swgl 0.1.0] cargo:warning= 2368 |   IMPLICIT mat3_scalar(const mat4_scalar& mat);
[swgl 0.1.0] cargo:warning=      |                                              ^
[swgl 0.1.0] cargo:warning=src/glsl.h:2413:40: warning: 'annotate' attribute directive ignored [-Wattributes]
[swgl 0.1.0] cargo:warning= 2413 |   IMPLICIT constexpr mat3(mat3_scalar s) {
[swgl 0.1.0] cargo:warning=      |                                        ^
[swgl 0.1.0] cargo:warning=src/glsl.h:2432:32: warning: 'annotate' attribute directive ignored [-Wattributes]
[swgl 0.1.0] cargo:warning= 2432 |   IMPLICIT mat3(const mat4& mat);
[swgl 0.1.0] cargo:warning=      |                                ^
[swgl 0.1.0] cargo:warning=src/glsl.h: In constructor 'constexpr glsl::mat3::mat3(glsl::mat3_scalar)':
[swgl 0.1.0] cargo:warning=src/glsl.h:2414:29: error: call to non-'constexpr' function 'glsl::vec3& glsl::vec3::operator=(glsl::vec3&&)'
[swgl 0.1.0] cargo:warning= 2414 |     data[0] = vec3(s.data[0]);
[swgl 0.1.0] cargo:warning=      |                             ^
[swgl 0.1.0] cargo:warning=src/glsl.h:1477:8: note: 'glsl::vec3& glsl::vec3::operator=(glsl::vec3&&)' is not usable as a 'constexpr' function because:
[swgl 0.1.0] cargo:warning= 1477 | struct vec3 {
[swgl 0.1.0] cargo:warning=      |        ^~~~

The Bugbug bot thinks this bug should belong to the 'Core::Graphics: WebRender' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.

Component: Untriaged → Graphics: WebRender
Product: Firefox → Core
Flags: needinfo?(lsalzman)
Severity: -- → S4

Avoid assigning to fields in the constructor body when it is constexpr.

Assignee: nobody → lsalzman
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Depends on: 1754752
Flags: needinfo?(lsalzman)

Comment on attachment 9279367 [details]
Bug 1771932 - Use more initializer lists in glsl.h. r?jrmuizel

ESR Uplift Approval Request

  • If this is not a sec:{high,crit} bug, please state case for ESR consideration: ESR 91 fails to build with GCC 12.
  • User impact if declined: GCC 12 can't build Firefox.
  • Fix Landed on Version:
  • Risk to taking this patch: Low
  • Why is the change risky/not risky? (and alternatives if risky): Doesn't change any semantics, so no risk.
Attachment #9279367 - Flags: approval-mozilla-esr91?
Pushed by lsalzman@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/1b0aa1c1f6b9 Use more initializer lists in glsl.h. r=gfx-reviewers,gw

Please nominate this for Beta uplift also. 102 is the next ESR so we care about it there too!

Flags: needinfo?(lsalzman)
Flags: needinfo?(lsalzman)

Comment on attachment 9279367 [details]
Bug 1771932 - Use more initializer lists in glsl.h. r?jrmuizel

ESR Uplift Approval Request

  • If this is not a sec:{high,crit} bug, please state case for ESR consideration:
  • User impact if declined: GCC 12 can't build Firefox.
  • Fix Landed on Version:
  • Risk to taking this patch: Low
  • Why is the change risky/not risky? (and alternatives if risky):
Attachment #9279367 - Flags: approval-mozilla-esr102?
Attachment #9279367 - Flags: approval-mozilla-esr102? → approval-mozilla-beta?
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 103 Branch

Comment on attachment 9279367 [details]
Bug 1771932 - Use more initializer lists in glsl.h. r?jrmuizel

Approved for 102 beta 4, thanks.

Attachment #9279367 - Flags: approval-mozilla-beta? → approval-mozilla-beta+

Comment on attachment 9279367 [details]
Bug 1771932 - Use more initializer lists in glsl.h. r?jrmuizel

Approved for 91.11esr.

Attachment #9279367 - Flags: approval-mozilla-esr91? → approval-mozilla-esr91+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: