view gcc/testsuite/g++.dg/cpp0x/defaulted57.C @ 158:494b0b89df80 default tip

...
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 25 May 2020 18:13:55 +0900
parents 84e7813d76e9
children
line wrap: on
line source

// Core Issue #1331 (const mismatch with defaulted copy constructor)
// { dg-do compile { target c++11 } }

// If T2 (what would be the implicit declaration) has a parameter of
// type const C&, the corresponding parameter of T1 may be of type C&.

struct S
{
  S& operator=(S &) = default;
};

struct T
{
  T& operator=(volatile T &) = default; // { dg-error "defaulted" }
};

struct U
{
  U& operator=(const volatile U &) = default; // { dg-error "defaulted" }
};

struct V
{
  V& operator=(const V &) = default;
};