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