diff options
Diffstat (limited to 'clang/test/ASTMerge')
-rw-r--r-- | clang/test/ASTMerge/class/Inputs/class1.cpp | 28 | ||||
-rw-r--r-- | clang/test/ASTMerge/class/Inputs/class2.cpp | 26 | ||||
-rw-r--r-- | clang/test/ASTMerge/class/test.cpp | 10 |
3 files changed, 64 insertions, 0 deletions
diff --git a/clang/test/ASTMerge/class/Inputs/class1.cpp b/clang/test/ASTMerge/class/Inputs/class1.cpp index b0a7645cfe6..2bd5503ecf3 100644 --- a/clang/test/ASTMerge/class/Inputs/class1.cpp +++ b/clang/test/ASTMerge/class/Inputs/class1.cpp @@ -18,3 +18,31 @@ struct C { enum E { b = 1 }; + +//Friend import tests +void f(); +int g(int a); +struct X; +struct Y; + +struct F1 { +public: + int x; + friend struct X; + friend int g(int); + friend void f(); +}; + +struct F2 { +public: + int x; + friend struct X; + friend void f(); +}; + +struct F3 { +public: + int x; + friend int g(int); + friend void f(); +}; diff --git a/clang/test/ASTMerge/class/Inputs/class2.cpp b/clang/test/ASTMerge/class/Inputs/class2.cpp index 2bed6d775bc..6fe38b92066 100644 --- a/clang/test/ASTMerge/class/Inputs/class2.cpp +++ b/clang/test/ASTMerge/class/Inputs/class2.cpp @@ -12,3 +12,29 @@ enum E { a = 0, b = 1 }; + +//Friend import tests +void f(); +int g(int a); +struct X; +struct Y; + +struct F1 { +public: + int x; + friend struct X; + friend int g(int); + friend void f(); +}; + +struct F2 { +public: + int x; + friend struct X; +}; + +struct F3 { +public: + int x; + friend void f(); +}; diff --git a/clang/test/ASTMerge/class/test.cpp b/clang/test/ASTMerge/class/test.cpp index a68a2d1d769..99926b649bc 100644 --- a/clang/test/ASTMerge/class/test.cpp +++ b/clang/test/ASTMerge/class/test.cpp @@ -12,3 +12,13 @@ // CHECK: class1.cpp:18:6: warning: type 'E' has incompatible definitions in different translation units // CHECK: class1.cpp:19:3: note: enumerator 'b' with value 1 here // CHECK: class2.cpp:12:3: note: enumerator 'a' with value 0 here + +// CHECK: class1.cpp:36:8: warning: type 'F2' has incompatible definitions in different translation units +// CHECK: class1.cpp:39:3: note: friend declared here +// CHECK: class2.cpp:30:8: note: no corresponding friend here + +// CHECK: class1.cpp:43:8: warning: type 'F3' has incompatible definitions in different translation units +// CHECK: class1.cpp:46:3: note: friend declared here +// CHECK: class2.cpp:36:8: note: no corresponding friend here + +// CHECK: 4 warnings generated. |