22 lines · cpp
1// RUN: %clang_cc1 -fsyntax-only -verify %s2 3// C++ [basic.def.odr]p1:4// No translation unit shall contain more than one definition of any5// variable, [...].6 7// Bad: in C++, these are both definitions. None of that C99 tentative stuff.8int i; // expected-note {{previous}}9int i; // expected-error {{redefinition}}10 11// OK: decl + def12extern int j;13int j;14 15// OK: def + decl16int k;17extern int k;18 19// Bad. The important thing here is that we don't emit the diagnostic twice.20int l = 1; // expected-note {{previous}}21int l = 2; // expected-error {{redefinition}}22