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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [g++.dg/] [warn/] [pr36921.C] - Blame information for rev 701

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

Line No. Rev Author Line
1 693 jeremybenn
/* PR 36921: comparison operator can be overloaded. Do not emit
2
   warnings in such case.
3
 { dg-do compile }
4
 { dg-options "-Wparentheses" }
5
*/
6
struct A {};
7
A operator<(A, A) { return A(); }
8
A operator>(A, A) { return A(); }
9
A operator<=(A, A) { return A(); }
10
A operator>=(A, A) { return A(); }
11
A operator==(A, A) { return A(); }
12
A operator!=(A, A) { return A(); }
13
 
14
int main() {
15
  A() < A() < A(); // should not emit warning
16
  1 < 2 < 3; // { dg-warning "mathematical meaning" "parentheses" }
17
  A() > A() > A(); // should not emit warning
18
  1 > 2 > 3; // { dg-warning "mathematical meaning" "parentheses" }
19
  A() <= A() <= A(); // should not emit warning
20
  1 <= 2 <= 3; // { dg-warning "mathematical meaning" "parentheses" }
21
  A() >= A() >= A(); // should not emit warning
22
  1 >= 2 >= 3; // { dg-warning "mathematical meaning" "parentheses" }
23
 
24
  A() == A() < A (); // { dg-warning "suggest parentheses" "parentheses" }
25
  A() < A() != A (); // { dg-warning "suggest parentheses" "parentheses" }
26
  return 0;
27
}

powered by: WebSVN 2.1.0

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