public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/33510]  New: Array size of array with size determined by the initializer wrong with packs
@ 2007-09-20 19:22 jakub at gcc dot gnu dot org
  2007-11-10  2:53 ` [Bug c++/33510] " dgregor at gcc dot gnu dot org
  2007-11-10  2:54 ` dgregor at gcc dot gnu dot org
  0 siblings, 2 replies; 3+ messages in thread
From: jakub at gcc dot gnu dot org @ 2007-09-20 19:22 UTC (permalink / raw)
  To: gcc-bugs

See http://gcc.gnu.org/ml/gcc-patches/2007-09/msg01600.html
// { dg-do run }
// { dg-options "-std=gnu++0x" }

extern "C" void abort ();

template<int M, int N> struct pair
{
  int i, j;
  pair () : i (M), j (N) {}
};

template<int... M> struct S
{
  template<int... N> static int *foo ()
  {
#ifdef SIZE_FROM_CTOR
    static int x[] = { (M + N)..., -1 };
#else
    static int x[1 + sizeof... N] = { (M + N)..., -1 };
#endif
    return x;
  }
};

int *bar ()
{
  return S<0, 1, 2>::foo<0, 1, 2> ();
}


int main ()
{
  int *p = bar ();
  if (p[0] != 0 || p[1] != 2 || p[2] != 4 || p[3] != -1)
    abort ();
}

should IMHO behave the same whether -DSIZE_FROM_CTOR is used or not.


-- 
           Summary: Array size of array with size determined by the
                    initializer wrong with packs
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jakub at gcc dot gnu dot org


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


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

* [Bug c++/33510] Array size of array with size determined by the initializer wrong with packs
  2007-09-20 19:22 [Bug c++/33510] New: Array size of array with size determined by the initializer wrong with packs jakub at gcc dot gnu dot org
@ 2007-11-10  2:53 ` dgregor at gcc dot gnu dot org
  2007-11-10  2:54 ` dgregor at gcc dot gnu dot org
  1 sibling, 0 replies; 3+ messages in thread
From: dgregor at gcc dot gnu dot org @ 2007-11-10  2:53 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from dgregor at gcc dot gnu dot org  2007-11-10 02:53 -------
Subject: Bug 33510

Author: dgregor
Date: Sat Nov 10 02:53:31 2007
New Revision: 130065

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=130065
Log:
2007-11-09  Douglas Gregor  <doug.gregor@gmail.com>

        PR c++/33510
        * decl.c (cp_complete_array_type): If any of the initializer
        elements are pack expansions, don't compute the array size yet.

2007-11-09  Douglas Gregor  <doug.gregor@gmail.com>

        PR c++/33510
        * g++.dg/cpp0x/variadic-init.C: New.

Added:
    trunk/gcc/testsuite/g++.dg/cpp0x/variadic-init.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/decl.c
    trunk/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug c++/33510] Array size of array with size determined by the initializer wrong with packs
  2007-09-20 19:22 [Bug c++/33510] New: Array size of array with size determined by the initializer wrong with packs jakub at gcc dot gnu dot org
  2007-11-10  2:53 ` [Bug c++/33510] " dgregor at gcc dot gnu dot org
@ 2007-11-10  2:54 ` dgregor at gcc dot gnu dot org
  1 sibling, 0 replies; 3+ messages in thread
From: dgregor at gcc dot gnu dot org @ 2007-11-10  2:54 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from dgregor at gcc dot gnu dot org  2007-11-10 02:54 -------
Fixed


-- 

dgregor at gcc dot gnu dot org changed:

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


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


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

end of thread, other threads:[~2007-11-10  2:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-09-20 19:22 [Bug c++/33510] New: Array size of array with size determined by the initializer wrong with packs jakub at gcc dot gnu dot org
2007-11-10  2:53 ` [Bug c++/33510] " dgregor at gcc dot gnu dot org
2007-11-10  2:54 ` dgregor at gcc dot gnu dot org

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).