public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/35147]  New: ICE trying to expand an argument pack with zero arguments
@ 2008-02-09 16:05 pedro dot lamarao at mndfck dot org
  2008-02-14 21:39 ` [Bug c++/35147] " dgregor at gcc dot gnu dot org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: pedro dot lamarao at mndfck dot org @ 2008-02-09 16:05 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1918 bytes --]

[pedro.lamarao@localhost Projetos]$ g++-4.3 -v
Using built-in specs.
Target: i686-pc-linux-gnu
Configured with: ../mainline/configure --prefix=/opt/gcc-4.3
--enable-languages=c,c++ : (reconfigured)  : (reconfigured)
../mainline/configure --prefix=/opt/gcc-4.3 --enable-languages=c,c++
--no-create --no-recursion : (reconfigured) ../mainline/configure
--prefix=/opt/gcc-4.3 --enable-languages=c,c++ --no-create --no-recursion
Thread model: posix
gcc version 4.3.0 20080208 (experimental) (GCC) 

[pedro.lamarao@localhost src]$ cat -n test_01.cpp 
     1  #include <functional>
     2
     3  using namespace std;
     4
     5  void
     6  j () { }
     7
     8  void
     9  h (int i) { }
    10
    11  template <typename Callable, typename... Args>
    12  void
    13  g (Callable c, Args&&... args) {
    14          function<void ()> callable = bind(h,
forward<Args...>(args...));
    15          callable();
    16  }
    17
    18  void
    19  f () {
    20          g(h, 0);
    21          g(j);
    22  }

[pedro.lamarao@localhost src]$ g++-4.3 --std=c++0x test_01.cpp 
test_01.cpp: In function ‘void g(Callable, Args&& ...) [with Callable = void
(*)(), Args = ]’:
test_01.cpp:21:   instantiated from here
test_01.cpp:14: internal compiler error: tree check: accessed elt 1 of tree_vec
with 0 elts in get_innermost_template_args, at cp/pt.c:515
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.


-- 
           Summary: ICE trying to expand an argument pack with zero
                    arguments
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: pedro dot lamarao at mndfck dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35147


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

* [Bug c++/35147] ICE trying to expand an argument pack with zero arguments
  2008-02-09 16:05 [Bug c++/35147] New: ICE trying to expand an argument pack with zero arguments pedro dot lamarao at mndfck dot org
@ 2008-02-14 21:39 ` dgregor at gcc dot gnu dot org
  2008-12-02 17:58 ` jason at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: dgregor at gcc dot gnu dot org @ 2008-02-14 21:39 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from dgregor at gcc dot gnu dot org  2008-02-14 21:38 -------
This code is actually ill-formed. The problem is here:

  bind(h, forward<Args...>(args...))

For N arguments, the second argument expands to:

  bind(h, forward<Args1, Args2, ..., ArgsN>(args1, args2, ..., argsN))

However, that's ill-formed because forward() accepts one template argument and
one function argument. We should have given a better error message when we try
to instantiate it with 0 arguments (instead, we crash).

The intent of the example is for the second argument to expand into "N"
different arguments:

  bind(h, forward<Args1>(args1), forward<Args2>(args2), ...,
forward<ArgsN>(argsN>)

That can be expressed like so:

  bind(h, forward<Args>(args)...)

With that change, and replacing "h" (a function) with "c" (the Callable
function object given to this function), this program runs.

Here is a simpler test case that produces the same compile-time failure without
including any C++0x headers:

template<typename _Tp>
  inline _Tp&& forward(_Tp&& __t) { return __t; }


void f(...);

template<typename... Args>
void g(Args&&... args)
{
  f(forward<Args...>(args...));
}

void h()
{
  g();
}


-- 

dgregor at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |dgregor at gcc dot gnu dot
                   |dot org                     |org
             Status|UNCONFIRMED                 |ASSIGNED
     Ever Confirmed|0                           |1
           Keywords|                            |ice-on-invalid-code
   Last reconfirmed|0000-00-00 00:00:00         |2008-02-14 21:38:40
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35147


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

* [Bug c++/35147] ICE trying to expand an argument pack with zero arguments
  2008-02-09 16:05 [Bug c++/35147] New: ICE trying to expand an argument pack with zero arguments pedro dot lamarao at mndfck dot org
  2008-02-14 21:39 ` [Bug c++/35147] " dgregor at gcc dot gnu dot org
@ 2008-12-02 17:58 ` jason at gcc dot gnu dot org
  2008-12-29  7:39 ` pinskia at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: jason at gcc dot gnu dot org @ 2008-12-02 17:58 UTC (permalink / raw)
  To: gcc-bugs



-- 

jason at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|dgregor at gcc dot gnu dot  |unassigned at gcc dot gnu
                   |org                         |dot org
             Status|ASSIGNED                    |NEW


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35147


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

* [Bug c++/35147] ICE trying to expand an argument pack with zero arguments
  2008-02-09 16:05 [Bug c++/35147] New: ICE trying to expand an argument pack with zero arguments pedro dot lamarao at mndfck dot org
  2008-02-14 21:39 ` [Bug c++/35147] " dgregor at gcc dot gnu dot org
  2008-12-02 17:58 ` jason at gcc dot gnu dot org
@ 2008-12-29  7:39 ` pinskia at gcc dot gnu dot org
  2009-02-06 12:51 ` paolo dot carlini at oracle dot com
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-12-29  7:39 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from pinskia at gcc dot gnu dot org  2008-12-29 07:37 -------
Related to PR 37737.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|2008-02-14 21:38:40         |2008-12-29 07:37:44
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35147


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

* [Bug c++/35147] ICE trying to expand an argument pack with zero arguments
  2008-02-09 16:05 [Bug c++/35147] New: ICE trying to expand an argument pack with zero arguments pedro dot lamarao at mndfck dot org
                   ` (2 preceding siblings ...)
  2008-12-29  7:39 ` pinskia at gcc dot gnu dot org
@ 2009-02-06 12:51 ` paolo dot carlini at oracle dot com
  2009-02-07  2:05 ` paolo at gcc dot gnu dot org
  2009-02-07  2:08 ` paolo dot carlini at oracle dot com
  5 siblings, 0 replies; 7+ messages in thread
From: paolo dot carlini at oracle dot com @ 2009-02-06 12:51 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from paolo dot carlini at oracle dot com  2009-02-06 12:51 -------
On it.


-- 

paolo dot carlini at oracle dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |paolo dot carlini at oracle
                   |dot org                     |dot com
             Status|NEW                         |ASSIGNED


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35147


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

* [Bug c++/35147] ICE trying to expand an argument pack with zero arguments
  2008-02-09 16:05 [Bug c++/35147] New: ICE trying to expand an argument pack with zero arguments pedro dot lamarao at mndfck dot org
                   ` (3 preceding siblings ...)
  2009-02-06 12:51 ` paolo dot carlini at oracle dot com
@ 2009-02-07  2:05 ` paolo at gcc dot gnu dot org
  2009-02-07  2:08 ` paolo dot carlini at oracle dot com
  5 siblings, 0 replies; 7+ messages in thread
From: paolo at gcc dot gnu dot org @ 2009-02-07  2:05 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from paolo at gcc dot gnu dot org  2009-02-07 02:05 -------
Subject: Bug 35147

Author: paolo
Date: Sat Feb  7 02:05:04 2009
New Revision: 144001

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=144001
Log:
/cp
2009-02-06  Paolo Carlini  <paolo.carlini@oracle.com>

        PR c++/35147
        PR c++/37737
        * cp-tree.h (TMPL_ARGS_HAVE_MULTIPLE_LEVELS): Check TREE_VEC_LENGTH.

/testsuite
2009-02-06  Paolo Carlini  <paolo.carlini@oracle.com>

        PR c++/35147
        PR c++/37737
        * g++.dg/cpp0x/vt-35147.C: New.
        * g++.dg/cpp0x/vt-37737-1.C: Likewise.
        * g++.dg/cpp0x/vt-37737-2.C: Likewise.

Added:
    trunk/gcc/testsuite/g++.dg/cpp0x/vt-35147.C
    trunk/gcc/testsuite/g++.dg/cpp0x/vt-37737-1.C
    trunk/gcc/testsuite/g++.dg/cpp0x/vt-37737-2.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/cp-tree.h
    trunk/gcc/testsuite/ChangeLog


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35147


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

* [Bug c++/35147] ICE trying to expand an argument pack with zero arguments
  2008-02-09 16:05 [Bug c++/35147] New: ICE trying to expand an argument pack with zero arguments pedro dot lamarao at mndfck dot org
                   ` (4 preceding siblings ...)
  2009-02-07  2:05 ` paolo at gcc dot gnu dot org
@ 2009-02-07  2:08 ` paolo dot carlini at oracle dot com
  5 siblings, 0 replies; 7+ messages in thread
From: paolo dot carlini at oracle dot com @ 2009-02-07  2:08 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from paolo dot carlini at oracle dot com  2009-02-07 02:08 -------
Fixed for 4.4.0.


-- 

paolo dot carlini at oracle dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35147


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

end of thread, other threads:[~2009-02-07  2:08 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-02-09 16:05 [Bug c++/35147] New: ICE trying to expand an argument pack with zero arguments pedro dot lamarao at mndfck dot org
2008-02-14 21:39 ` [Bug c++/35147] " dgregor at gcc dot gnu dot org
2008-12-02 17:58 ` jason at gcc dot gnu dot org
2008-12-29  7:39 ` pinskia at gcc dot gnu dot org
2009-02-06 12:51 ` paolo dot carlini at oracle dot com
2009-02-07  2:05 ` paolo at gcc dot gnu dot org
2009-02-07  2:08 ` paolo dot carlini at oracle dot 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).