A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/llvm/llvm-project/issues/56310 below:

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

For this code:

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

// foo.h
template <class T> concept A = true;

// bar.h
template <class T> 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 <class T> void foo() requires A<T> {}
void main() { foo<int>(); }

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.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4