[Bug c++/66092] [c++-concepts] Concept can't check variadic template arguments

2015-08-04 Thread jason at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66092

Jason Merrill jason at gcc dot gnu.org changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

--- Comment #7 from Jason Merrill jason at gcc dot gnu.org ---
Crash was fixed.


[Bug c++/66092] [c++-concepts] Concept can't check variadic template arguments

2015-07-17 Thread jason at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66092

--- Comment #6 from Jason Merrill jason at gcc dot gnu.org ---
Author: jason
Date: Fri Jul 17 17:43:09 2015
New Revision: 225959

URL: https://gcc.gnu.org/viewcvs?rev=225959root=gccview=rev
Log:
PR c++/66092
PR c++/66834
* gcc/cp/pt.c (coerce_template_parms): Re-apply earlier change.

Added:
branches/c++-concepts/gcc/testsuite/g++.dg/concepts/dr1430.C
Modified:
branches/c++-concepts/ChangeLog.concepts
branches/c++-concepts/gcc/cp/pt.c


[Bug c++/66092] [c++-concepts] Concept can't check variadic template arguments

2015-07-13 Thread jason at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66092

--- Comment #5 from Jason Merrill jason at gcc dot gnu.org ---
Author: jason
Date: Tue Jul 14 04:11:11 2015
New Revision: 225758

URL: https://gcc.gnu.org/viewcvs?rev=225758root=gccview=rev
Log:
PR c++/66092
PR c++/66834
* gcc/cp/pt.c (coerce_template_parms): Revert earlier change.

Removed:
branches/c++-concepts/gcc/testsuite/g++.dg/concepts/dr1430.C
Modified:
branches/c++-concepts/ChangeLog.concepts
branches/c++-concepts/gcc/cp/pt.c


[Bug c++/66092] [c++-concepts] Concept can't check variadic template arguments

2015-07-10 Thread jason at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66092

--- Comment #4 from Jason Merrill jason at gcc dot gnu.org ---
Author: jason
Date: Fri Jul 10 07:25:49 2015
New Revision: 225649

URL: https://gcc.gnu.org/viewcvs?rev=225649root=gccview=rev
Log:
PR c++/66092
* gcc/cp/cp-tree.h (concept_template_p): New.
* gcc/cp/pt.c (coerce_template_parms): Concepts are also affected
by DR 1430.
* gcc/cp/constraint.cc (lift_template_id): Use location_of.
* gcc/cp/parser.c (cp_parser_template_id): SET_EXPR_LOCATION.

Added:
branches/c++-concepts/gcc/testsuite/g++.dg/concepts/dr1430.C
Modified:
branches/c++-concepts/ChangeLog.concepts
branches/c++-concepts/gcc/cp/constraint.cc
branches/c++-concepts/gcc/cp/cp-tree.h
branches/c++-concepts/gcc/cp/parser.c
branches/c++-concepts/gcc/cp/pt.c
branches/c++-concepts/gcc/testsuite/g++.dg/concepts/var-concept3.C


[Bug c++/66092] [c++-concepts] Concept can't check variadic template arguments

2015-07-09 Thread jason at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66092

Jason Merrill jason at gcc dot gnu.org changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2015-07-10
 CC||jason at gcc dot gnu.org
 Ever confirmed|0   |1

--- Comment #3 from Jason Merrill jason at gcc dot gnu.org ---
(In reply to Andrew Sutton from comment #2)
 I think that this should be ill-formed.
 
 template typename T, typename U, typename... Args
   concept bool Same()
   {
 return decltype(checkT, U, Args...())::value;
   }
 
 template typename... Args
 requires SameArgs...()
   void foo( Args... args ) {}
 
 
 Template constraint processing requires that flatten (inline) the check for
 SameArgs...(), but I don't see how we can substitute a dependent argument
 pack into three distinct template parameters (T, U, and ...Args). 
 
 The wording prohibiting this is missing in the TS.

Agreed, this is basically the same issue as core issue 1430 for alias
templates.  We can fix the crash on this testcase by adding concepts to the DR
1430 check in coerce_template_parms, but complain is tf_none at that point so
we don't get a helpful error message.  Any thoughts on that?  It seems to me
that we probably want to pass complain through the normalize/lift functions.

Is there something to address this in your latest draft?


[Bug c++/66092] [c++-concepts] Concept can't check variadic template arguments

2015-05-19 Thread andrew.n.sutton at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66092

Andrew Sutton andrew.n.sutton at gmail dot com changed:

   What|Removed |Added

 CC||andrew.n.sutton at gmail dot 
com

--- Comment #2 from Andrew Sutton andrew.n.sutton at gmail dot com ---
I think that this should be ill-formed.

template typename T, typename U, typename... Args
  concept bool Same()
  {
return decltype(checkT, U, Args...())::value;
  }

template typename... Args
requires SameArgs...()
  void foo( Args... args ) {}


Template constraint processing requires that flatten (inline) the check for
SameArgs...(), but I don't see how we can substitute a dependent argument
pack into three distinct template parameters (T, U, and ...Args). 

The wording prohibiting this is missing in the TS.


[Bug c++/66092] [c++-concepts] Concept can't check variadic template arguments

2015-05-13 Thread yingpo.liao at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66092

--- Comment #1 from Ying-Po Liao yingpo.liao at gmail dot com ---
Here's another implementation, which results in the same consequence.

template typename T, typename U, typename... Args
  struct Checker
  {
constexpr static decltype(auto) check( std::true_type )
{ return std::integral_constantbool, __is_same_as(T, U)(); }

constexpr static decltype(auto) check( std::false_type )
{ return std::integral_constantbool, __is_same_as(T, U) 
   CheckerU, Args...::value(); }

constexpr static bool value = decltype( 
  check( std::integral_constantbool, (sizeof...(Args)==0)() ) 
)::value;
  };

template typename T, typename U, typename... Args
  concept bool Same()
  {
return CheckerT, U, Args...::value;
  }