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] - Blame information for rev 853

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

Line No. Rev Author Line
1 149 jeremybenn
// { dg-do compile }
2
// { dg-options "-Weffc++" }
3
// Contributed by Benjamin Kosnik 
4
// PR c++/16169 : Improve -Weffc++ rule 15
5
 
6
struct A {
7
 const A& foo();
8
 const A& operator=(int)
9
 { return foo(); }
10
};
11
 
12
struct B {
13
  B& foo();
14
  B& operator=(int)
15
  { return foo(); }
16
};
17
 
18
struct C {
19
  C& operator=(int)
20
  { return *this; }
21
};
22
 
23
struct D {
24
  D operator=(int)
25
  { return *this; }      // { dg-warning "should return a reference" }
26
};
27
 
28
struct E {
29
  E& foo();
30
  E operator=(int)
31
  { return foo(); }      // { dg-warning "should return a reference" }
32
};
33
 
34
struct F
35
{
36
  operator float();
37
  float operator=(int)
38
  { return *this; }      // { dg-warning "should return a reference" }
39
};

powered by: WebSVN 2.1.0

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