[PATCH] D110641: Implement P0857R0 -Part B: requires clause for template-template params

Erich Keane via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 14 12:17:53 PDT 2022


erichkeane added inline comments.


================
Comment at: clang/test/SemaTemplate/concepts.cpp:63
   template<typename T> concept C = true;
-  template<template<typename T> requires C<T> typename U> struct X {}; // expected-error {{requires 'class'}} expected-error 0+{{}}
+  template<template<typename T> requires C<T> typename U> struct X {};
   template<typename T> requires C<T> struct Y {};
----------------
erichkeane wrote:
> Seemingly if "X" contains U<int>, the constraint should be checked (according to EWG).
> 
> Based on reflector conversations, it seems this should ALSO be checked in:
> 
> http://eel.is/c++draft/temp.arg.template#3
> and 
> http://eel.is/c++draft/temp.arg.template#4
> , particularly the 'rewrite to function templates in /4 should produce a constrained function template, and the 'at least as specialized' check takes these into consideration.
> 
> They are ALSO considered in partial ordering.
That example(X has a U<int> in it) asserts against `main` since it causes us to not properly instantiate the constraints.  On top of my 'deferred constraints instantiation' patch (https://reviews.llvm.org/D119544 ) it fails to diagnose (consistent with GCC, but not EDG).


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D110641/new/

https://reviews.llvm.org/D110641



More information about the cfe-commits mailing list