hanchenye-llvm-project/clang/test/CXX/stmt.stmt/stmt.select/p3.cpp

19 lines
436 B
C++

// RUN: %clang_cc1 -fsyntax-only -verify %s
int f();
void g() {
if (int x = f()) { // expected-note 2{{previous definition}}
int x; // expected-error{{redefinition of 'x'}}
} else {
int x; // expected-error{{redefinition of 'x'}}
}
}
void h() {
if (int x = f()) // expected-note 2{{previous definition}}
int x; // expected-error{{redefinition of 'x'}}
else
int x; // expected-error{{redefinition of 'x'}}
}