OSDN Git Service

PR testsuite/25241
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / g++.dg / template / warn1.C
1 // { dg-do compile }
2 // { dg-options "-Wall" }
3
4 // Copyright (C) 2003 Free Software Foundation, Inc.
5 // Contributed by Nathan Sidwell 14 Aug 2003 <nathan@codesourcery.com>
6
7 // PR 11512. erroneous warnings
8
9 template <class T>  void Foo(T i) 
10
11   i++, i++;
12   i, i++; // { dg-warning "left-hand operand" "" }
13   i++, i; // { dg-warning "right-hand operand" "" }
14   for (;; --i, ++i)
15     ;
16
17  
18 void Bar ()
19
20   Foo (1);  // { dg-message "instantiated" }
21 }
22
23 struct M {};
24
25 struct C
26 {
27   M m;
28   C () :m (M ()) {}
29 };
30
31
32 void Baz (int i)
33 {
34   i ? i + 1 : i + 2; // { dg-warning "operand of" }
35   i ? i++ : 0;
36 }