[Bug c++/103746] [12 Regression] Rejected code "call to non-‘constexpr’ function ‘glsl::vec3& glsl::vec3::operator=(glsl::vec3&&)’" since r12-5256-g37326651b439bac5

marxin at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Dec 16 11:40:56 GMT 2021


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103746

--- Comment #4 from Martin Liška <marxin at gcc dot gnu.org> ---
Reduced test-case:

struct VectorType {
  void operator=(VectorType);
};
template <typename> using V4 = VectorType;
using Float = V4<float>;
struct vec3 {
  Float x;
};
struct mat3 {
  vec3 data[3];
  constexpr mat3() { data[2] = vec3(); }
};

$ g++ ff.ii -c
ff.ii: In constructor ‘constexpr mat3::mat3()’:
ff.ii:11:37: error: call to non-‘constexpr’ function ‘vec3&
vec3::operator=(vec3&&)’
   11 |   constexpr mat3() { data[2] = vec3(); }
      |                                     ^
ff.ii:6:8: note: ‘vec3& vec3::operator=(vec3&&)’ is not usable as a ‘constexpr’
function because:
    6 | struct vec3 {
      |        ^~~~
ff.ii:2:8: note: defaulted constructor calls non-‘constexpr’ ‘void
VectorType::operator=(VectorType)’
    2 |   void operator=(VectorType);
      |        ^~~~~~~~
ff.ii:2:8: note: ‘void VectorType::operator=(VectorType)’ declared here


More information about the Gcc-bugs mailing list