Files
TheRock/compiler/amd-llvm/clang/test/Modules/merge-concepts.cppm
T
derek.holloway 7502bf64a4
CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

184 lines
4.8 KiB
C++

// RUN: rm -rf %t
// RUN: mkdir %t
// RUN: split-file %s %t
//
// RUN: %clang_cc1 -std=c++20 -emit-module-interface -I%t %t/A.cppm -o %t/A.pcm
// RUN: %clang_cc1 -std=c++20 -emit-module-interface -I%t %t/B.cppm -o %t/B.pcm
// RUN: %clang_cc1 -std=c++20 -fprebuilt-module-path=%t %t/Use.cpp -verify -fsyntax-only
// RUN: %clang_cc1 -std=c++20 -fprebuilt-module-path=%t %t/Use2.cpp -verify -fsyntax-only
// RUN: %clang_cc1 -std=c++20 -fprebuilt-module-path=%t %t/Use3.cpp -verify -fsyntax-only
// RUN: %clang_cc1 -std=c++20 -fprebuilt-module-path=%t %t/Use4.cpp -verify -fsyntax-only
// RUN: %clang_cc1 -std=c++20 -fprebuilt-module-path=%t %t/C.cppm -verify -fsyntax-only
// RUN: %clang_cc1 -std=c++20 -I%t %t/D.cppm -verify -fsyntax-only
// RUN: %clang_cc1 -std=c++20 -I%t %t/E.cppm -verify -fsyntax-only
// RUN: %clang_cc1 -std=c++20 -I%t %t/F.cppm -verify -fsyntax-only
//
// Testing header units for coverity.
// RUN: %clang_cc1 -std=c++20 -emit-header-unit -xc++-user-header %t/foo.h -o %t/foo.pcm
// RUN: %clang_cc1 -std=c++20 -fprebuilt-module-path=%t -fmodule-file=%t/foo.pcm %t/Use5.cpp -verify -fsyntax-only
// RUN: %clang_cc1 -std=c++20 -fprebuilt-module-path=%t -fmodule-file=%t/foo.pcm %t/Use6.cpp -verify -fsyntax-only
//
// Testing with module map modules. It is unclear about the relation ship between Clang modules and
// C++20 Named Modules. Will they coexist? Or will they be mutually exclusive?
// The test here is for primarily coverity.
//
// RUN: rm -f %t/foo.pcm
// RUN: %clang_cc1 -std=c++20 -fmodules -fmodules-cache-path=%t -fprebuilt-module-path=%t \
// RUN: -fmodule-map-file=%t/module.modulemap %t/Use7.cpp -verify -fsyntax-only
// RUN: %clang_cc1 -std=c++20 -fmodules -fmodules-cache-path=%t -fprebuilt-module-path=%t \
// RUN: -fmodule-map-file=%t/module.modulemap %t/Use7.cpp -verify -fsyntax-only
// Testing module map modules with named modules.
// RUN: %clang_cc1 -std=c++20 -fmodules -fmodules-cache-path=%t -fmodule-map-file=%t/module.modulemap \
// RUN: %t/A.cppm -o %t/A.pcm
// RUN: %clang_cc1 -std=c++20 -fmodules -fmodules-cache-path=%t -fprebuilt-module-path=%t \
// RUN: -fmodule-map-file=%t/module.modulemap %t/Use7.cpp -verify -fsyntax-only
// RUN: %clang_cc1 -std=c++20 -fmodules -fmodules-cache-path=%t -fprebuilt-module-path=%t \
// RUN: -fmodule-map-file=%t/module.modulemap %t/Use7.cpp -verify -fsyntax-only
//
//--- foo.h
#ifndef FOO_H
#define FOO_H
template <class T, class U>
concept same_as = __is_same(T, U);
#endif
// The compiler would warn if we include foo_h twice without guard.
//--- redecl.h
#ifndef REDECL_H
#define REDECL_H
template <class T, class U>
concept same_as = __is_same(T, U);
#endif
//--- A.cppm
module;
#include "foo.h"
export module A;
export using ::same_as;
//--- B.cppm
module;
#include "foo.h"
export module B;
export using ::same_as;
//--- Use.cpp
// expected-no-diagnostics
import A;
import B;
template <class T> void foo()
requires same_as<T, int>
{}
//--- Use2.cpp
// expected-no-diagnostics
#include "foo.h"
import A;
template <class T> void foo()
requires same_as<T, int>
{}
//--- Use3.cpp
// expected-no-diagnostics
import A;
#include "foo.h"
template <class T> void foo()
requires same_as<T, int>
{}
//--- Use4.cpp
// expected-no-diagnostics
import A;
import B;
#include "foo.h"
template <class T> void foo()
requires same_as<T, int>
{}
//--- C.cppm
// expected-no-diagnostics
module;
#include "foo.h"
export module C;
import A;
import B;
template <class T> void foo()
requires same_as<T, int>
{}
//--- D.cppm
module;
#include "foo.h"
#include "redecl.h"
export module D;
export using ::same_as;
// expected-error@* {{redefinition of 'same_as'}}
// expected-note@* 1+{{previous definition is here}}
//--- E.cppm
module;
#include "foo.h"
export module E;
export template <class T, class U>
concept same_as = __is_same(T, U);
// expected-error@* {{redefinition of 'same_as'}}
// expected-note@* 1+{{previous definition is here}}
//--- F.cppm
export module F;
template <class T, class U>
concept same_as = __is_same(T, U);
template <class T, class U>
concept same_as = __is_same(T, U);
// expected-error@* {{redefinition of 'same_as'}}
// expected-note@* 1+{{previous definition is here}}
//--- Use5.cpp
import "foo.h"; // expected-warning {{the implementation of header units is in an experimental phase}}
import A;
template <class T> void foo()
requires same_as<T, int>
{}
//--- Use6.cpp
import A;
import "foo.h"; // expected-warning {{the implementation of header units is in an experimental phase}}
template <class T> void foo()
requires same_as<T, int>
{}
//--- module.modulemap
module "foo" {
export *
header "foo.h"
}
//--- Use7.cpp
// expected-no-diagnostics
#include "foo.h"
import A;
template <class T> void foo()
requires same_as<T, int>
{}
//--- Use8.cpp
// expected-no-diagnostics
import A;
#include "foo.h"
template <class T> void foo()
requires same_as<T, int>
{}