Skip to content

[RFC] [C++20] [Modules] Relax the ODR check for decls in global module fragment #79240

Closed
@ChuanqiXu9

Description

@ChuanqiXu9

The false positive ODR violation diagnostic for modules have been an annoying problem for a long time. We've received a lot of issue reports about it and I rarely see the reports saying the mechanism find real ODR violations. (a suspicious one may be #61643).

Then in a private chat with MSVC developer, he told me MSVC don't check ODR violations in the global module fragment. This is a surprise to me and I never thought we can proceed by this. I feel this may be a regression at first. But I feel it might make sense due to:

  • Like I said before, there are a lot of false positive ODR violation diagnostic while the true positive diagnostics are much less.
  • On the other hand, given that the things in the global module fragment are mostly from headers, it won't be a regression compared with the era before modules.
  • It is really hard for the compiler to get ODR Hash correct in the GMF due to the complexity of headers and C++. An example may be [C++20] [Modules] False Positive ODR violation diagnostic due to using inconsistent qualified but the same type #78850. While all of us love standard conforming implementation, sometimes it is really hard to get things right.

So I'd like to take the same strategy with MSVC to not check ODR violations in the global module fragment.

Given the fact that this is actually a regression on the standard conformance, I am not sure if people have different opinions.

Metadata

Metadata

Assignees

Labels

clang:modulesC++20 modules and Clang Header Modules

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions