public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/94100] New: ICE: tree check: accessed elt 1 of 'tree_vec' with 0 elts in tsubst_pack_expansion, at cp/pt.c:12765
@ 2020-03-09 12:51 jjk at acm dot org
  2020-03-09 14:24 ` [Bug c++/94100] " mpolacek at gcc dot gnu.org
  2020-07-02 23:12 ` hstong at ca dot ibm.com
  0 siblings, 2 replies; 3+ messages in thread
From: jjk at acm dot org @ 2020-03-09 12:51 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 94100
           Summary: ICE: tree check: accessed elt 1 of 'tree_vec' with 0
                    elts in tsubst_pack_expansion, at cp/pt.c:12765
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jjk at acm dot org
  Target Milestone: ---

Created attachment 47998
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=47998&action=edit
Source file to be compiled.

The attached file elicits an ICE in the GCC "trunk" version used by Compiler
Explorer (https://godbolt.org/z/iPK_JV):
------------
<source>: In function 'int main()':
<source>:20:24: internal compiler error: tree check: accessed elt 1 of
'tree_vec' with 0 elts in tsubst_pack_expansion, at cp/pt.c:12765
   20 |   Foo<bool>::foo<true>();
      |                        ^
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://gcc.gnu.org/bugs/> for instructions.
------------

When using GCC 9.2, no ICE happens, but the file fails to be parsed:
------------
<source>: In function 'int main()':
<source>:20:24: error: no matching function for call to
'Foo<bool>::foo<true>()'
   20 |   Foo<bool>::foo<true>();
      |                        ^
<source>:11:3: note: candidate: 'template<ARGS ...args> static void
Foo<ARGS>::foo() [with ARGS ...args = {args ...}; ARGS = {bool}]'
   11 |   foo(void)
      |   ^~~
<source>:11:3: note:   template argument deduction/substitution failed:
<source>:21:31: error: no matching function for call to 'Foo<int, long
int>::foo<42, 23>()'
   21 |   Foo<int, long>::foo<42, 23>();
      |                               ^
<source>:11:3: note: candidate: 'template<ARGS ...args> static void
Foo<ARGS>::foo() [with ARGS ...args = {args ...}; ARGS = {int, long int}]'
   11 |   foo(void)
      |   ^~~
<source>:11:3: note:   template argument deduction/substitution failed:
<source>:21:31: error: wrong number of template arguments (2, should be 1)
   21 |   Foo<int, long>::foo<42, 23>();
      |                               ^
<source>:22:34: error: no matching function for call to 'Foo<char,
char>::foo<'h', 'i'>()'
   22 |   Foo<char, char>::foo<'h', 'i'>();
      |                                  ^
<source>:11:3: note: candidate: 'template<ARGS ...args> static void
Foo<ARGS>::foo() [with ARGS ...args = {args ...}; ARGS = {char, char}]'
   11 |   foo(void)
      |   ^~~
<source>:11:3: note:   template argument deduction/substitution failed:
<source>:22:34: error: wrong number of template arguments (2, should be 1)
   22 |   Foo<char, char>::foo<'h', 'i'>();
      |                                  ^
------------

Clang correctly compiles the file.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug c++/94100] ICE: tree check: accessed elt 1 of 'tree_vec' with 0 elts in tsubst_pack_expansion, at cp/pt.c:12765
  2020-03-09 12:51 [Bug c++/94100] New: ICE: tree check: accessed elt 1 of 'tree_vec' with 0 elts in tsubst_pack_expansion, at cp/pt.c:12765 jjk at acm dot org
@ 2020-03-09 14:24 ` mpolacek at gcc dot gnu.org
  2020-07-02 23:12 ` hstong at ca dot ibm.com
  1 sibling, 0 replies; 3+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2020-03-09 14:24 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2020-03-09
                 CC|                            |mpolacek at gcc dot gnu.org
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1

--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
The ICE started with r0-128638-gb0ff7fe1d223260aea5b7dc3f36892aa57d43c77 -- a
while ago.  Before that:

94100.C:19:24: error: no matching function for call to ‘Foo<bool>::foo()’
   Foo<bool>::foo<true>();
                        ^

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug c++/94100] ICE: tree check: accessed elt 1 of 'tree_vec' with 0 elts in tsubst_pack_expansion, at cp/pt.c:12765
  2020-03-09 12:51 [Bug c++/94100] New: ICE: tree check: accessed elt 1 of 'tree_vec' with 0 elts in tsubst_pack_expansion, at cp/pt.c:12765 jjk at acm dot org
  2020-03-09 14:24 ` [Bug c++/94100] " mpolacek at gcc dot gnu.org
@ 2020-07-02 23:12 ` hstong at ca dot ibm.com
  1 sibling, 0 replies; 3+ messages in thread
From: hstong at ca dot ibm.com @ 2020-07-02 23:12 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Hubert Tong <hstong at ca dot ibm.com> ---
The following ICEs in a similar fashion:
internal compiler error: tree check: accessed elt 2 of 'tree_vec' with 1 elts
in tsubst, at cp/pt.c:15334

### SOURCE:
template <typename... T> struct ValListWithTypes {
  template <T... Members> struct WithVals {
    using TypeList = ValListWithTypes;
  };
};

template <typename ValList, typename ValTypeList = typename ValList::TypeList>
struct Widget;

template <typename ValList, typename... ValTypes>
struct Widget<ValList, ValListWithTypes<ValTypes...>> {
  template <typename = ValList> struct Impl {};
};

template <typename ValList, typename... ValTypes>
template <ValTypes... Vals>
struct Widget<ValList, ValListWithTypes<ValTypes...>>::Impl<
    typename ValListWithTypes<ValTypes...>::template WithVals<Vals...>> {};

int main(void) { Widget<ValListWithTypes<int>::WithVals<0>>::Impl<> impl; }

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-07-02 23:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-09 12:51 [Bug c++/94100] New: ICE: tree check: accessed elt 1 of 'tree_vec' with 0 elts in tsubst_pack_expansion, at cp/pt.c:12765 jjk at acm dot org
2020-03-09 14:24 ` [Bug c++/94100] " mpolacek at gcc dot gnu.org
2020-07-02 23:12 ` hstong at ca dot ibm.com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).