OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [testsuite/] [g++.dg/] [warn/] [effc2.C] - Rev 844

Go to most recent revision | Compare with Previous | Blame | View Log

// { dg-do compile }
// { dg-options "-Weffc++" }
// Contributed by Benjamin Kosnik <bkoz at redhat dot com>
// PR c++/16169 : Improve -Weffc++ rule 15

struct A {
 const A& foo();
 const A& operator=(int)
 { return foo(); }
};

struct B {
  B& foo();
  B& operator=(int)
  { return foo(); }
};

struct C {
  C& operator=(int)
  { return *this; }
};

struct D {
  D operator=(int)
  { return *this; }      // { dg-warning "should return a reference" }
};

struct E {
  E& foo();
  E operator=(int)
  { return foo(); }      // { dg-warning "should return a reference" }
};

struct F
{
  operator float();
  float operator=(int)
  { return *this; }      // { dg-warning "should return a reference" }
};

Go to most recent revision | Compare with Previous | Blame | View Log

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.