1// RUN: rm -rf %t 2// RUN: mkdir -p %t 3// RUN: split-file %s %t 4// 5// Treat the behavior of using headers as baseline. 6// RUN: %clang_cc1 -std=c++20 %t/use-header.cc -isystem %t -fsyntax-only -verify 7// 8// RUN: %clang_cc1 -std=c++20 %t/a.cppm -isystem %t -emit-module-interface -o %t/a.pcm 9// RUN: %clang_cc1 -std=c++20 %t/use-module.cc -isystem %t -fmodule-file=a=%t/a.pcm -fsyntax-only -verify 10 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.pcm 13// RUN: %clang_cc1 -std=c++20 %t/use-module.cc -isystem %t -fmodule-file=a=%t/a.pcm -fsyntax-only -verify 14 15//--- sys.h 16#ifndef SYS_H 17#define SYS_H 18 19#pragma GCC system_header 20 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#endif 43 44//--- use-header.cc 45// expected-no-diagnostics 46// However, we see unexpected warnings 47#include <sys.h> 48 49void use() { 50 C<int>().i(); 51} 52 53//--- a.cppm 54module; 55#include <sys.h> 56export module a; 57export using ::iterator; 58export using ::C; 59 60//--- use-module.cc 61// expected-no-diagnostics 62import a; 63 64void use() { 65 C<int>().i(); 66} 67