blob: 88747714e5c1f35fd426e699404938bd3fd1837e [file] [log] [blame]
Richard Smithbbcc9f02016-08-26 00:14:38 +00001// RUN: %clang_cc1 -std=c++1z -fmodules-ts -emit-module-interface %s -o %t.pcm -verify -DTEST=0
2// RUN: %clang_cc1 -std=c++1z -fmodules-ts -emit-module-interface %s -o %t.pcm -verify -Dmodule=int -DTEST=1
3// RUN: not %clang_cc1 -std=c++1z -fmodules-ts -emit-module-interface %s -fmodule-file=%t.pcm -o %t.pcm -DTEST=2 2>&1 | FileCheck %s --check-prefix=CHECK-2
4// RUN: %clang_cc1 -std=c++1z -fmodules-ts -emit-module-interface %s -fmodule-file=%t.pcm -o %t.pcm -verify -Dfoo=bar -DTEST=3
5
6#if TEST == 0
7// expected-no-diagnostics
8#endif
9
10module foo;
11#if TEST == 1
12// expected-error@-2 {{expected module declaration at start of module interface}}
13#elif TEST == 2
14// CHECK-2: error: redefinition of module 'foo'
15#endif
16
17int n;
18#if TEST == 3
19// expected-error@-2 {{redefinition of 'n'}}
20// expected-note@-3 {{previous}}
21#endif