saarraz / clang-concepts-monorepo

****** OBSOLETE - CONCEPTS HAS BEEN MERGED INTO CLANG TRUNK AND DEVELOPMENT CONTINUES THERE ****** This fork of llvm-project contains my implementation of C++2a Concepts for the Clang compiler, and will be updated regularly with bug fixes until the whole feature is merged to trunk. Follow the instructions here https://clang.llvm.org/get_started.html to build, then use the flags "-std=c++2a -Xclang -fconcepts-ts" to enable concepts.
27 stars 3 forks source link

Concept definitions with unexpanded variadic template parameters evaluate to true #22

Open davidstone opened 5 years ago

davidstone commented 5 years ago
template<typename T0, typename T1>
int c = 1;

template<typename... Ts>
concept c_wrapper = c<Ts>;

static_assert(c_wrapper<>);
static_assert(c_wrapper<int>);
static_assert(c_wrapper<int, int>);
static_assert(c_wrapper<int, int, int>);

This fails to diagnose the unexpanded parameter pack Ts in c_wrapper. Instead, it seems to treat all uses of that expression as true, so all of the static_asserts pass.

https://godbolt.org/z/aLPsZH

davidstone commented 4 years ago

I'm not sure what the correct behavior is here, by the way: diagnosing the unexpanded pack or treating the concept as always false.