https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92102

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2019-10-15
     Ever confirmed|0                           |1

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Reduced:


template<typename>
  concept nope = false;

template<typename>
  concept sure_thing = true;

template<typename T>
  struct category
  { };

template<typename T> requires (!nope<T>)
  struct category<T>
  { };

template<typename T> requires (!nope<T>) && sure_thing<T>
  struct category<T>
  { using type = T; };

category<int>::type t;



ambig.cc:19:14: error: ambiguous template instantiation for 'struct
category<int>'
   19 | category<int>::type t;
      |              ^~
ambig.cc:12:10: note: candidates are: 'template<class T>  requires !(nope<T>)
struct category<T> [with T = int]'
   12 |   struct category<T>
      |          ^~~~~~~~~~~
ambig.cc:16:10: note:                 'template<class T>  requires !(nope<T>)
&& (sure_thing<T>) struct category<T> [with T = int]'
   16 |   struct category<T>
      |          ^~~~~~~~~~~
ambig.cc:19:16: error: invalid use of incomplete type 'struct category<int>'
   19 | category<int>::type t;
      |                ^~~~
ambig.cc:8:10: note: declaration of 'struct category<int>'
    8 |   struct category
      |          ^~~~~~~~


To make subsumption of (!E) work I need to add a concept for !E


template<typename T>
  concept nope_nope = !nope<T>;


and then use that:


template<typename T> requires nope_nope<T>
  struct category<T>
  { };

template<typename T> requires nope_nope<T> && sure_thing<T>
  struct category<T>
  { using type = T; };

Reply via email to