view gcc/testsuite/g++.dg/conversion/op4.C @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children
line wrap: on
line source

/* PR c++/26698 */
/* { dg-do compile } */

struct X {
  int x;
  X (int i = 0) : x (i) {}
  operator X& (void) const { // { dg-warning "will never use" }
    return *(new X);
  }
};

void add_one (X & ref) { /* { dg-message "argument" } */
  ++ ref.x;
}

void foo() {
  X const a (2);
  add_one(a); /* { dg-error "discards qualifiers" } */
}