| 1 |
// Test that we will skip ODR checks for declarations from PCH if they |
| 2 |
// were from GMF. |
| 3 |
// |
| 4 |
// RUN: rm -rf %t |
| 5 |
// RUN: mkdir -p %t |
| 6 |
// RUN: split-file %s %t |
| 7 |
// |
| 8 |
// RUN: %clang_cc1 -std=c++20 -emit-reduced-module-interface %t/A.cppm \ |
| 9 |
// RUN: -o %t/A.pcm -fskip-odr-check-in-gmf |
| 10 |
// RUN: %clang_cc1 -std=c++20 -DDIFF -x c++-header %t/foo.h \ |
| 11 |
// RUN: -emit-pch -o %t/foo.pch -fskip-odr-check-in-gmf |
| 12 |
// RUN: %clang_cc1 -std=c++20 %t/B.cppm -fmodule-file=A=%t/A.pcm -include-pch \ |
| 13 |
// RUN: %t/foo.pch -verify -fsyntax-only -fskip-odr-check-in-gmf |
| 14 |
|
| 15 |
//--- foo.h |
| 16 |
#ifndef FOO_H |
| 17 |
#define FOO_H |
| 18 |
inline int foo() { |
| 19 |
#ifndef DIFF |
| 20 |
return 43; |
| 21 |
#else |
| 22 |
return 45; |
| 23 |
#endif |
| 24 |
} |
| 25 |
|
| 26 |
class f { |
| 27 |
public: |
| 28 |
int mem() { |
| 29 |
#ifndef DIFF |
| 30 |
return 47; |
| 31 |
#else |
| 32 |
return 45; |
| 33 |
#endif |
| 34 |
} |
| 35 |
}; |
| 36 |
#endif |
| 37 |
|
| 38 |
//--- A.cppm |
| 39 |
module; |
| 40 |
#include "foo.h" |
| 41 |
export module A; |
| 42 |
export using ::foo; |
| 43 |
export using ::f; |
| 44 |
|
| 45 |
//--- B.cppm |
| 46 |
// expected-no-diagnostics |
| 47 |
module; |
| 48 |
#include "foo.h" |
| 49 |
export module B; |
| 50 |
import A; |
| 51 |
export int b = foo() + f().mem(); |