concept A = true; // bar.h template concept A = ...">

Clang does not check for ODR violations when merging concepts from different modules · Issue #56310 · llvm/llvm-project (original) (raw)

Skip to content

Provide feedback

Saved searches

Use saved searches to filter your results more quickly

Sign up

@ilya-biryukov

Description

@ilya-biryukov

For this code:

// module.map module "foo" { export * header "foo.h" } module "bar" { export * header "bar.h" }

// foo.h template concept A = true;

// bar.h template concept A = false;

// foo.cpp // clang -std=c++20 -fmodules -fimplicit-modules -fmodule-map-file=module.map foo.cpp #include "foo.h" #include "bar.h"

template void foo() requires A {} void main() { foo(); }

Expected: compiling the code produces an error as concept A is defined differently in two consumed modules, therefore it produces an ODR violation.
Actual: no error about ODR violation. Depending on the chosen concept a call to foo<int>() either succeeds or fails.