Clang Project

clang_source_code/test/Modules/odr_hash-Friend.cpp
1// RUN: rm -rf %t
2
3// PR35939: MicrosoftMangle.cpp triggers an assertion failure on this test.
4// UNSUPPORTED: system-windows
5
6// RUN: %clang_cc1 \
7// RUN:  -I %S/Inputs/odr_hash-Friend \
8// RUN:  -emit-obj -o /dev/null \
9// RUN:  -fmodules \
10// RUN:  -fimplicit-module-maps \
11// RUN:  -fmodules-cache-path=%t/modules.cache \
12// RUN:  -std=c++11 -x c++ %s -verify -DTEST1
13
14// RUN: %clang_cc1 \
15// RUN:  -I %S/Inputs/odr_hash-Friend \
16// RUN:  -emit-obj -o /dev/null \
17// RUN:  -fmodules \
18// RUN:  -fimplicit-module-maps \
19// RUN:  -fmodules-cache-path=%t/modules.cache \
20// RUN:  -std=c++11 -x c++ %s -verify -DTEST2
21
22// RUN: %clang_cc1 \
23// RUN:  -I %S/Inputs/odr_hash-Friend \
24// RUN:  -emit-obj -o /dev/null \
25// RUN:  -fmodules \
26// RUN:  -fimplicit-module-maps \
27// RUN:  -fmodules-cache-path=%t/modules.cache \
28// RUN:  -std=c++11 -x c++ %s -verify -DTEST3
29
30// RUN: %clang_cc1 \
31// RUN:  -I %S/Inputs/odr_hash-Friend \
32// RUN:  -emit-obj -o /dev/null \
33// RUN:  -fmodules \
34// RUN:  -fimplicit-module-maps \
35// RUN:  -fmodules-cache-path=%t/modules.cache \
36// RUN:  -std=c++11 -x c++ %s -verify -DTEST3
37
38// RUN: %clang_cc1 \
39// RUN:  -I %S/Inputs/odr_hash-Friend \
40// RUN:  -emit-obj -o /dev/null \
41// RUN:  -fmodules \
42// RUN:  -fimplicit-module-maps \
43// RUN:  -fmodules-cache-path=%t/modules.cache \
44// RUN:  -std=c++11 -x c++ %s -verify -DTEST3
45
46#if defined(TEST1)
47#include "Box.h"
48#include "M1.h"
49#include "M3.h"
50// expected-no-diagnostics
51#endif
52
53#if defined(TEST2)
54#include "Box.h"
55#include "M1.h"
56#include "M3.h"
57#include "Good.h"
58// expected-no-diagnostics
59#endif
60
61#if defined(TEST3)
62#include "Good.h"
63#include "Box.h"
64#include "M1.h"
65#include "M3.h"
66// expected-no-diagnostics
67#endif
68
69#if defined(TEST4)
70#include "Box.h"
71#include "M1.h"
72#include "M3.h"
73#include "Bad.h"
74// expected-error@Bad.h:* {{'Check' has different definitions in different modules; definition in module 'Bad' first difference is function body}}
75// expected-note@Box.h:* {{but in 'Box' found a different body}}
76#endif
77
78#if defined(TEST5)
79#include "Bad.h"
80#include "Box.h"
81#include "M1.h"
82#include "M3.h"
83// expected-error@Bad.h:* {{'Check' has different definitions in different modules; definition in module 'Bad' first difference is function body}}
84// expected-note@Box.h:* {{but in 'Box' found a different body}}
85#endif
86
87
88void Run() {
89  Box<> Present;
90}
91