[Bug c++/104326] New: Deduction failure for parameter pack in template template non-type parameter

2022-02-01 Thread colavitam at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104326

Bug ID: 104326
   Summary: Deduction failure for parameter pack in template
template non-type parameter
   Product: gcc
   Version: 11.2.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: colavitam at gmail dot com
  Target Milestone: ---

Consider the following code:

```
template 
struct tuple {};

template 
struct Test;

template <
typename... Types,
template  typename... Outer,
Types... Inner
>
struct Test...>> {};

template  struct O1 {};
template  struct O2 {};
template  struct O3 {};

Test, O2<2>>> test1;
Test, O2<2>, O3<3>>> test2;
```

This code is rejected by gcc and accepted by clang.

gcc accepts the definition of test1 but rejects test2. It appears as though
Types is not being correctly expanded with the template template parameter.

[Bug c++/104326] Deduction failure for parameter pack in template template non-type parameter

2022-02-01 Thread colavitam at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104326

--- Comment #2 from Michael Colavita  ---
It doesn't appear to be specific to the long and unsigned case. The problem
persists if you change unsigned to another type (or replace it with something
like a member pointer). I can't find an accepted case where the non-type
parameter type of O3 is different than the non-type parameter type of O2/O1.

e.g. the following still fails:

/* ... */
struct S {
long field;
};

template  struct O1 {};
template  struct O2 {};
template  struct O3 {};

Test, O2<3>>> test1;
Test, O2<3>, O3<&S::field>>> test2;

[Bug c++/104326] Deduction failure for parameter pack in template template non-type parameter

2022-02-01 Thread colavitam at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104326

--- Comment #4 from Michael Colavita  ---
This is a slightly different case, but if you change

-   template  typename... Outer,
+   template  typename... Outer,

it is accepted by both MSVC and clang (whereas gcc now rejects both test1 and
test2). ICC still ICEs.

[Bug c++/104390] New: Tree check ICE for valid code

2022-02-04 Thread colavitam at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104390

Bug ID: 104390
   Summary: Tree check ICE for valid code
   Product: gcc
   Version: 12.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: colavitam at gmail dot com
  Target Milestone: ---

The following code produces an ICE (-std=c++17):

template 
struct A {};

struct B {
long v;
};

template
struct C {
template
static void f(const A& src) {}
};

void g() {
C::f<&B::v>({});
}

---

: In function 'void g()':
:15:25: internal compiler error: tree check: accessed elt 2 of
'tree_vec' with 0 elts in tsubst_pack_expansion, at cp/pt.cc:13125
   15 | C::f<&B::v>({});
  | ^~~~