forked from llvm/llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[C++20] [Modules] Don't diagnose duplicated implicit decl in multiple…
… named modules (llvm#102423) Close llvm#102360 Close llvm#102349 http://eel.is/c++draft/basic.def.odr#15.3 makes it clear that the duplicated deinition are not allowed to be attached to named modules. But we need to filter the implicit declarations as user can do nothing about it and the diagnostic message is annoying. (cherry picked from commit e72d956)
- Loading branch information
1 parent
2c29bd3
commit 3f193bc
Showing
3 changed files
with
154 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
// 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 -emit-module-interface -o %t/b.pcm \ | ||
// RUN: -fprebuilt-module-path=%t | ||
// RUN: %clang_cc1 -std=c++20 %t/c.cppm -emit-module-interface -o %t/c.pcm \ | ||
// RUN: -fprebuilt-module-path=%t | ||
// RUN: %clang_cc1 -std=c++20 %t/d.cpp -fsyntax-only -verify \ | ||
// RUN: -fprebuilt-module-path=%t | ||
|
||
//--- a.cppm | ||
export module a; | ||
|
||
export template<typename> | ||
struct a; | ||
|
||
template<typename> | ||
struct a { | ||
}; | ||
|
||
export template<typename T> | ||
constexpr auto aa = a<T>(); | ||
|
||
//--- b.cppm | ||
export module b; | ||
|
||
import a; | ||
|
||
static void b() { | ||
static_cast<void>(a<void>()); | ||
} | ||
|
||
//--- c.cppm | ||
export module c; | ||
|
||
import a; | ||
|
||
static void c() { | ||
static_cast<void>(aa<void>); | ||
} | ||
|
||
//--- d.cpp | ||
// expected-no-diagnostics | ||
import a; | ||
import b; | ||
import c; | ||
|
||
static void d() { | ||
static_cast<void>(a<void>()); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
// 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 -emit-module-interface -o %t/b.pcm \ | ||
// RUN: -fprebuilt-module-path=%t | ||
// RUN: %clang_cc1 -std=c++20 %t/c.cppm -emit-module-interface -o %t/c.pcm \ | ||
// RUN: -fprebuilt-module-path=%t | ||
// RUN: %clang_cc1 -std=c++20 %t/d.cpp -fsyntax-only -verify \ | ||
// RUN: -fprebuilt-module-path=%t | ||
|
||
//--- a.cppm | ||
export module a; | ||
|
||
template<typename> | ||
constexpr auto impl = true; | ||
|
||
export template<typename T> | ||
void a() { | ||
} | ||
|
||
export template<typename T> requires impl<T> | ||
void a() { | ||
} | ||
|
||
//--- b.cppm | ||
export module b; | ||
|
||
import a; | ||
|
||
static void b() { | ||
a<void>(); | ||
} | ||
|
||
//--- c.cppm | ||
export module c; | ||
|
||
import a; | ||
|
||
static void c() { | ||
a<void>(); | ||
} | ||
|
||
//--- d.cpp | ||
// expected-no-diagnostics | ||
import a; | ||
import b; | ||
import c; | ||
|
||
static void d() { | ||
a<void>(); | ||
} |