Fortran: Fix PR 47485.
[gcc.git] / gcc / testsuite / g++.dg / warn / Wduplicated-cond2.C
blobc977389a2e4eed8cbd9419142ca2d83faa5d8b02
1 // PR c++/105035
2 // { dg-do compile }
3 // { dg-options "-Wduplicated-cond" }
5 class A {
6   struct B { int c; int f; } e;
7   template <typename> void foo ();
8   void bar ();
9 };
11 template <typename> void
12 A::foo ()
14   int g;
15   if (&g == &e.c)
16     ;
17   else if (&g == &e.f)
18     ;
21 void
22 A::bar ()
24   int g;
25   if (&g == &e.c)       // { dg-message "previously used here" }
26     ;
27   else if (&g == &e.c)  // { dg-warning "duplicated 'if' condition" }
28     ;