brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.0 KiB · 45cc5e3 Raw
80 lines · plain
1// RUN: rm -rf %t2// RUN: mkdir -p %t3// RUN: split-file %s %t4//5// RUN: %clang_cc1 -std=c++20 -emit-module-interface %t/a.cppm -o %t/a.pcm6// RUN: %clang_cc1 -std=c++20 %t/b.cppm -fprebuilt-module-path=%t -emit-module-interface -o %t/b.pcm -verify7//8// Testing the behavior of `-fskip-odr-check-in-gmf`9// RUN: %clang_cc1 -std=c++20 -fskip-odr-check-in-gmf  -emit-module-interface %t/a.cppm -o \10// RUN:   %t/a.pcm11// RUN: %clang_cc1 -std=c++20 -fskip-odr-check-in-gmf  %t/b.cppm -fprebuilt-module-path=%t \12// RUN:   -emit-module-interface -DSKIP_ODR_CHECK_IN_GMF -o %t/b.pcm -verify13 14// RUN: %clang_cc1 -std=c++20 -emit-reduced-module-interface %t/a.cppm -o %t/a.pcm15// RUN: %clang_cc1 -std=c++20 %t/b.cppm -fprebuilt-module-path=%t -emit-reduced-module-interface \16// RUN:     -o %t/b.pcm -verify -DREDUCED17 18//--- foo.h19 20namespace std21{22    template<class _Dom1>23    void operator &&(_Dom1 __v, _Dom1 __w)24    { 25        return;26    }27}28 29//--- bar.h30namespace std 31{32  template<typename... _Types>33    struct _Traits34    {35      static constexpr bool _S_copy_ctor =36   (__is_trivial(_Types) && ...);37    };38 39  template<typename... _Types>40    struct variant41    {42      void43      swap(variant& __rhs)44      noexcept((__is_trivial(_Types) && ...))45      {46      }47    };48}49 50//--- a.cppm51module;52// The operator&& defined in 'foo.h' will pollute the 53// expression '__is_trivial(_Types) && ...' in bar.h54#include "foo.h"55#include "bar.h"56export module a;57export namespace std {58  using std::variant;59  using std::_Traits;60  using std::operator&&;61}62 63//--- b.cppm64module;65#include "bar.h"66export module b;67import a;68export namespace std {69  using std::variant;70  using std::_Traits;71  using std::operator&&;72}73 74#ifdef SKIP_ODR_CHECK_IN_GMF75// expected-no-diagnostics76#else77// expected-error@* {{has different definitions in different modules; first difference is defined here found data member '_S_copy_ctor' with an initializer}}78// expected-note@* {{but in 'a.<global>' found data member '_S_copy_ctor' with a different initializer}}79#endif80