Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / CXX / basic / basic.def.odr / p1-var.cpp
blob892f546ee54513acf6ae2fc9d36c8852865a49f1
1 // RUN: %clang_cc1 -fsyntax-only -verify %s
3 // C++ [basic.def.odr]p1:
4 // No translation unit shall contain more than one definition of any
5 // variable, [...].
7 // Bad: in C++, these are both definitions. None of that C99 tentative stuff.
8 int i; // expected-note {{previous}}
9 int i; // expected-error {{redefinition}}
11 // OK: decl + def
12 extern int j;
13 int j;
15 // OK: def + decl
16 int k;
17 extern int k;
19 // Bad. The important thing here is that we don't emit the diagnostic twice.
20 int l = 1; // expected-note {{previous}}
21 int l = 2; // expected-error {{redefinition}}