(root)/
gcc-13.2.0/
gcc/
testsuite/
g++.dg/
warn/
Wduplicated-cond2.C
// PR c++/105035
// { dg-do compile }
// { dg-options "-Wduplicated-cond" }

class A {
  struct B { int c; int f; } e;
  template <typename> void foo ();
  void bar ();
};

template <typename> void
A::foo ()
{
  int g;
  if (&g == &e.c)
    ;
  else if (&g == &e.f)
    ;
}

void
A::bar ()
{
  int g;
  if (&g == &e.c)	// { dg-message "previously used here" }
    ;
  else if (&g == &e.c)	// { dg-warning "duplicated 'if' condition" }
    ;
}