diff --git a/clang/lib/Sema/SemaModule.cpp b/clang/lib/Sema/SemaModule.cpp --- a/clang/lib/Sema/SemaModule.cpp +++ b/clang/lib/Sema/SemaModule.cpp @@ -395,7 +395,7 @@ // [module.interface]p1: // An export-declaration shall inhabit a namespace scope and appear in the // purview of a module interface unit. - Diag(ExportLoc, diag::err_export_not_in_module_interface); + Diag(ExportLoc, diag::err_export_not_in_module_interface) << 0; } return Import; diff --git a/clang/test/Modules/cxx20-export-import.cpp b/clang/test/Modules/cxx20-export-import.cpp new file mode 100644 --- /dev/null +++ b/clang/test/Modules/cxx20-export-import.cpp @@ -0,0 +1,3 @@ + +// RUN: %clang_cc1 -std=c++20 -fmodules -fmodules-cache-path=%t -fimplicit-module-maps -I%S/Inputs -verify %s +export import dummy; // expected-error {{export declaration can only be used within a module interface unit after the module declaration}}