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