brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.4 KiB · 96781b3 Raw
67 lines · plain
1// RUN: rm -rf %t2// RUN: mkdir -p %t3// RUN: split-file %s %t4//5// Treat the behavior of using headers as baseline.6// RUN: %clang_cc1 -std=c++20 %t/use-header.cc -isystem %t -fsyntax-only -verify7//8// RUN: %clang_cc1 -std=c++20 %t/a.cppm -isystem %t -emit-module-interface -o %t/a.pcm9// RUN: %clang_cc1 -std=c++20 %t/use-module.cc -isystem %t -fmodule-file=a=%t/a.pcm -fsyntax-only -verify10 11// Test again with reduced BMI.12// RUN: %clang_cc1 -std=c++20 %t/a.cppm -isystem %t -emit-reduced-module-interface -o %t/a.pcm13// RUN: %clang_cc1 -std=c++20 %t/use-module.cc -isystem %t -fmodule-file=a=%t/a.pcm -fsyntax-only -verify14 15//--- sys.h16#ifndef SYS_H17#define SYS_H18 19#pragma GCC system_header20 21template <class C>22struct [[deprecated]] iterator {};23 24_Pragma("GCC diagnostic push")25_Pragma("GCC diagnostic ignored \"-Wdeprecated\"")                         26_Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"")27 28template <class C>29struct reverse_iterator 30: public iterator<C> {};31 32_Pragma("GCC diagnostic pop")33 34template <class T>35class C {36public:37    void i() {38        reverse_iterator<T> i;39    }40};41 42#endif43 44//--- use-header.cc45// expected-no-diagnostics46// However, we see unexpected warnings47#include <sys.h>48 49void use() {50    C<int>().i();51}52 53//--- a.cppm54module;55#include <sys.h>56export module a;57export using ::iterator;58export using ::C;59 60//--- use-module.cc61// expected-no-diagnostics62import a;63 64void use() {65    C<int>().i();66}67