================ @@ -457,6 +457,28 @@ Note that **currently** the compiler doesn't consider inconsistent macro definit Currently Clang would accept the above example. But it may produce surprising results if the debugging code depends on consistent use of ``NDEBUG`` also in other translation units. +Definitions consistency +^^^^^^^^^^^^^^^^^^^^^^^ + +The C++ language defines that same declarations in different translation units should have +the same definition, as known as ODR (One Definition Rule). Prior to modules, the translation +units don't dependent on each other and the compiler itself don't and can't perform a strong +ODR violation check. Sometimes it is the linker does some jobs related to ODR, where the +higher level semantics are missing. With the introduction of modules, now the compiler have +the chance to perform ODR violations with language semantics across translation units. ---------------- mizvekov wrote:
```suggestion The C++ language defines that same declarations in different translation units should have the same definition, as known as ODR (One Definition Rule). Prior to modules, the translation units don't dependent on each other and the compiler itself can't perform a strong ODR violation check. With the introduction of modules, now the compiler have the chance to perform ODR violations with language semantics across translation units. ``` https://github.com/llvm/llvm-project/pull/79959 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits