bloomberg/clang-p2996

Explicitly disallow concept splicers in template parameter declarations

Opened this issue · 0 comments

Given the following:

template <std::meta::info R>
struct Outer {
  template <template [:R:] Param>
  struct Inner { /* ... */ };
};

It's not possible to tell at parse time whether Param is a non-type parameter of deduced type (i.e., if R reflects a class template) or if it's a type parameter (i.e., if R reflects a concept). The most obvious way to disambiguate this would be to introduce a "concept splicer" syntax (i.e., concept [:R:]), but we would prefer to add this in a later paper, and only if its absence is felt by users.

We're instead intending to disallow concept splicers in template parameter declarations. Note that this is easily worked around using requires clauses:

template <std::meta::info R>
struct Outer {
  template <typename T> requires template [:R:]<T>
  struct Inner { /* ... */ }
};