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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.2.2/] [gcc/] [testsuite/] [g++.dg/] [warn/] [effc2.C] - Diff between revs 149 and 154

Go to most recent revision | Only display areas with differences | Details | Blame | View Log

Rev 149 Rev 154
// { dg-do compile }
// { dg-do compile }
// { dg-options "-Weffc++" }
// { dg-options "-Weffc++" }
// Contributed by Benjamin Kosnik 
// Contributed by Benjamin Kosnik 
// PR c++/16169 : Improve -Weffc++ rule 15
// PR c++/16169 : Improve -Weffc++ rule 15
struct A {
struct A {
 const A& foo();
 const A& foo();
 const A& operator=(int)
 const A& operator=(int)
 { return foo(); }
 { return foo(); }
};
};
struct B {
struct B {
  B& foo();
  B& foo();
  B& operator=(int)
  B& operator=(int)
  { return foo(); }
  { return foo(); }
};
};
struct C {
struct C {
  C& operator=(int)
  C& operator=(int)
  { return *this; }
  { return *this; }
};
};
struct D {
struct D {
  D operator=(int)
  D operator=(int)
  { return *this; }      // { dg-warning "should return a reference" }
  { return *this; }      // { dg-warning "should return a reference" }
};
};
struct E {
struct E {
  E& foo();
  E& foo();
  E operator=(int)
  E operator=(int)
  { return foo(); }      // { dg-warning "should return a reference" }
  { return foo(); }      // { dg-warning "should return a reference" }
};
};
struct F
struct F
{
{
  operator float();
  operator float();
  float operator=(int)
  float operator=(int)
  { return *this; }      // { dg-warning "should return a reference" }
  { return *this; }      // { dg-warning "should return a reference" }
};
};
 
 

powered by: WebSVN 2.1.0

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