Skip to content

[C++20] [Modules] We can't diagnose the case that import before module declarations but not in GMF #67627

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ChuanqiXu9 opened this issue Sep 28, 2023 · 1 comment
Assignees
Labels
clang:modules C++20 modules and Clang Header Modules

Comments

@ChuanqiXu9
Copy link
Member

Reproducer:

// RUN: rm -rf %t
// RUN: mkdir -p %t
// RUN: split-file %s %t
//
// RUN: %clang_cc1 -std=c++20 %t/A.cppm -emit-module-interface -o %t/A.pcm
// RUN: %clang_cc1 -std=c++20 %t/B.cppm -fmodule-file=A=%t/A.pcm -fsyntax-only -verify

//--- A.cppm
export module A;

//--- B.cppm
import A;
export module B;

Actual behavior: no diagnostic emitted.
Expected behavior: an error diagnostic to tell we can't import A here.

@ChuanqiXu9 ChuanqiXu9 added the clang:modules C++20 modules and Clang Header Modules label Sep 28, 2023
@ChuanqiXu9 ChuanqiXu9 self-assigned this Sep 28, 2023
@llvmbot
Copy link
Member

llvmbot commented Sep 28, 2023

@llvm/issue-subscribers-clang-modules

Reproducer:
// RUN: rm -rf %t
// RUN: mkdir -p %t
// RUN: split-file %s %t
//
// RUN: %clang_cc1 -std=c++20 %t/A.cppm -emit-module-interface -o %t/A.pcm
// RUN: %clang_cc1 -std=c++20 %t/B.cppm -fmodule-file=A=%t/A.pcm -fsyntax-only -verify

//--- A.cppm
export module A;

//--- B.cppm
import A;
export module B;

Actual behavior: no diagnostic emitted.
Expected behavior: an error diagnostic to tell we can't import A here.

legrosbuffle pushed a commit to legrosbuffle/llvm-project that referenced this issue Sep 29, 2023
…t being in GMF

Close llvm#67627

In a module unit, all the declaration before the modoule declaration
should live in the GMF.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang:modules C++20 modules and Clang Header Modules
Projects
None yet
Development

No branches or pull requests

2 participants