brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.2 KiB · eaf033d Raw
64 lines · plain
1// RUN: rm -fr %t2// RUN: mkdir %t3// RUN: split-file %s %t4//5// RUN: %clang_cc1 -std=c++20 %t/B.cppm -I%t -emit-module-interface -o %t/B.pcm6// RUN: %clang_cc1 -std=c++20 -fsyntax-only %t/A.cppm -I%t -fprebuilt-module-path=%t -verify7//8// RUN: %clang_cc1 -std=c++20 %t/D.cppm -I%t -emit-module-interface -o %t/D.pcm9// RUN: %clang_cc1 -std=c++20 -fsyntax-only %t/D-part.cppm -I%t -fprebuilt-module-path=%t -verify10 11// RUN: %clang_cc1 -std=c++20 %t/B.cppm -I%t -emit-reduced-module-interface -o %t/B.pcm12// RUN: %clang_cc1 -std=c++20 -fsyntax-only %t/A.cppm -I%t -fprebuilt-module-path=%t -verify13//14// RUN: %clang_cc1 -std=c++20 %t/D.cppm -I%t -emit-reduced-module-interface -o %t/D.pcm15// RUN: %clang_cc1 -std=c++20 -fsyntax-only %t/D-part.cppm -I%t -fprebuilt-module-path=%t -verify16 17//--- A.cppm18module;19export module baz:A;20import B;21#include "C.h"22 23//--- B.cppm24module;25 26#include "C.h"27export module B;28 29namespace foo {30    export using foo::bar;31}32 33//--- C.h34namespace foo {35  template<class T, class U> struct bar { // expected-error {{declaration of 'bar' in module baz:A follows declaration in the global module}} // expected-note {{previous declaration is here}}36      template<class, class> bar(T, U);37  };38  template<class T, class U> bar(T, U) -> bar<T, U>; // expected-error {{declaration of '<deduction guide for bar>' in module baz:A follows declaration in the global module}} // expected-note {{previous declaration is here}}39}40 41//--- D.cppm42// Tests that it is still problematic if they are in one module.43module;44#include "E.h"45export module D;46 47namespace foo {48    export using foo::bar;49}50 51//--- D-part.cppm52export module D:part;53import D;54#include "E.h"55 56//--- E.h57// another file for simpler diagnostics.58namespace foo {59  template<class T, class U> struct bar { // expected-error {{declaration of 'bar' in module D:part follows declaration in the global module}} // expected-note {{previous declaration is here}}60      template<class, class> bar(T, U);61  };62  template<class T, class U> bar(T, U) -> bar<T, U>; // expected-error {{declaration of '<deduction guide for bar>' in module D:part follows declaration in the global module}} // expected-note {{previous declaration is here}}63}64