[Bug c++/71267] [C++14] recursive metafunction won't compile: no type named 'type'

2021-08-05 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71267

--- Comment #3 from Jonathan Wakely  ---
Accepted since r12-1094 and r11-8714:

c++: argument pack with expansion [PR86355]

This testcase revealed that we were using PACK_EXPANSION_EXTRA_ARGS a lot
more than necessary; use_pack_expansion_extra_args_p meant to use it in the
case of corresponding arguments in different argument packs differing in
whether they are pack expansions, but it was mistakenly also returning true
for the case of a single argument pack containing both expansion and
non-expansion elements.

Surprisingly, just disabling that didn't lead to any regressions in the
testsuite; it seems other changes have prevented us getting to this point
for code that used to exercise it.  So this patch limits the check to
arguments in the same position in the packs, and asserts that we never
actually see a mismatch.

PR c++/86355

gcc/cp/ChangeLog:

* pt.c (use_pack_expansion_extra_args_p): Don't compare
args from the same argument pack.

gcc/testsuite/ChangeLog:

* g++.dg/cpp0x/alias-decl-variadic2.C: New test.

[Bug c++/71267] [C++14] recursive metafunction won't compile: no type named 'type'

2021-08-04 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71267

Andrew Pinski  changed:

   What|Removed |Added

  Known to fail||10.3.0, 11.1.0
  Known to work||11.2.0

--- Comment #2 from Andrew Pinski  ---
Looks fixed in GCC 11.2.0 and GCC12+.

[Bug c++/71267] [C++14] recursive metafunction won't compile: no type named 'type'

2016-05-24 Thread pinskia at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71267

Andrew Pinski  changed:

   What|Removed |Added

   Keywords||rejects-valid
 Status|UNCONFIRMED |NEW
   Last reconfirmed||2016-05-25
Summary|recursive metafunction  |[C++14] recursive
   |won't compile: no type  |metafunction won't compile:
   |named 'type'|no type named 'type'
 Ever confirmed|0   |1

--- Comment #1 from Andrew Pinski  ---
Here is a reduced such that we don't depend on any headers:
template 
struct tt{};

template 
struct typelist {};

// specialization of typelist for std::integral_constant<>s
#ifdef WORKS
template 
struct integer_typelist {};
#else
template 
using integer_typelist = typelist...>;
#endif

// helper metafunction to generate typelist<> of integral_constant<>s by
// specifying a Start, End, and Step value
template 
struct make_integer_list_impl;

// specialization for: Start < End
template 
struct make_integer_list_impl, true>
{
typedef typename make_integer_list_impl<
  Start+Step, End, Step,
  integer_typelist
  >::type type;
};

// specialization for: Start >= End (terminate the recursion)
template 
struct make_integer_list_impl, false>
{
using type = integer_typelist;
};

// helper alias template
template 
using make_integer_typelist = typename
  make_integer_list_impl::type;

int main()
{
// typelist<
// std::integral_constant,
// std::integral_constant,
// std::integral_constant,
// std::integral_constant,
// std::integral_constant
// >
using t2 = make_integer_typelist<0, 13, 3>;
}


- CUT 
If we change integer_typelist to a template struct instead of an using alias,
it works.