brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.9 KiB · 76aec48 Raw
112 lines · plain
1// https://github.com/llvm/llvm-project/issues/607752//3// RUN: rm -rf %t4// RUN: mkdir -p %t5// RUN: split-file %s %t6//7// RUN: %clang_cc1 -std=c++20 %t/a.cppm -I%t -emit-module-interface -o %t/a.pcm8// RUN: %clang_cc1 -std=c++20 %t/b.cpp -fmodule-file=a=%t/a.pcm -verify -fsyntax-only9// RUN: %clang_cc1 -std=c++20 %t/c.cppm -I%t -emit-module-interface -o %t/c.pcm10// RUN: %clang_cc1 -std=c++20 %t/d.cppm -emit-module-interface -fmodule-file=c=%t/c.pcm -o %t/d.pcm11// RUN: %clang_cc1 -std=c++20 %t/e.cpp -fmodule-file=d=%t/d.pcm -fmodule-file=c=%t/c.pcm -verify -fsyntax-only12// RUN: %clang_cc1 -std=c++20 %t/f.cppm -emit-module-interface -fmodule-file=c=%t/c.pcm -o %t/f.pcm13// RUN: %clang_cc1 -std=c++20 %t/g.cpp -fmodule-file=f=%t/f.pcm -fmodule-file=c=%t/c.pcm  -verify -fsyntax-only14 15// Test again with reduced BMI16// RUN: rm -rf %t17// RUN: mkdir -p %t18// RUN: split-file %s %t19//20// RUN: %clang_cc1 -std=c++20 %t/a.cppm -I%t -emit-reduced-module-interface -o %t/a.pcm21// RUN: %clang_cc1 -std=c++20 %t/b.cpp -fmodule-file=a=%t/a.pcm -verify -fsyntax-only22// RUN: %clang_cc1 -std=c++20 %t/c.cppm -I%t -emit-reduced-module-interface -o %t/c.pcm23// RUN: %clang_cc1 -std=c++20 %t/d.cppm -emit-reduced-module-interface -fmodule-file=c=%t/c.pcm -o %t/d.pcm24// RUN: %clang_cc1 -std=c++20 %t/e.cpp -fmodule-file=d=%t/d.pcm -fmodule-file=c=%t/c.pcm -verify -fsyntax-only25// RUN: %clang_cc1 -std=c++20 %t/f.cppm -emit-reduced-module-interface -fmodule-file=c=%t/c.pcm -o %t/f.pcm26// RUN: %clang_cc1 -std=c++20 %t/g.cpp -fmodule-file=f=%t/f.pcm -fmodule-file=c=%t/c.pcm  -verify -fsyntax-only27 28//--- initializer_list.h29namespace std {30  typedef decltype(sizeof(int)) size_t;31  template<typename T> struct initializer_list {32    const T* ptr; size_t sz;33    initializer_list(const T *, size_t);34    const T* begin();35    const T* end();36  };37}38 39//--- a.cppm40module;41#include "initializer_list.h"42export module a;43export template<typename>44void a() {45	for (int x : {0}) {46	}47}48 49//--- b.cpp50// expected-no-diagnostics51import a;52void b() {53	a<int>();54}55 56//--- c.cppm57module;58#include "initializer_list.h"59export module c;60namespace std {61    export using std::initializer_list;62}63 64//--- d.cppm65export module d;66import c;67export template<typename>68void d() {69	for (int x : {0}) {70	}71}72 73//--- e.cpp74import d;75void e() {76    for (int x : {0}) { // expected-error {{cannot deduce type of initializer list because std::initializer_list was not found; include <initializer_list>}}77	}78}79 80template <typename>81void ee() {82    for (int x : {0}) { // expected-error {{cannot deduce type of initializer list because std::initializer_list was not found; include <initializer_list>}}83    }84}85 86void eee() {87    ee<int>();88    d<int>();89}90 91//--- f.cppm92export module f;93export import c;94 95//--- g.cpp96// expected-no-diagnostics97import f;98void g() {99    for (int x : {0}) {100	}101}102 103template <typename>104void gg() {105    for (int x : {0}) {106    }107}108 109void ggg() {110    gg<int>();111}112