public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/56614] New: [4.7/4.8 Regression] error: default argument 'std::vector<E>(std::initializer_list<E>{((const E*)(& ._0)), 1u}, (*(const std::allocator<E>*)(& std::allocator<E>())))' uses local variable '._0'
@ 2013-03-13 14:46 redi at gcc dot gnu.org
  2013-03-13 16:48 ` [Bug c++/56614] " paolo.carlini at oracle dot com
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: redi at gcc dot gnu.org @ 2013-03-13 14:46 UTC (permalink / raw)
  To: gcc-bugs


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

             Bug #: 56614
           Summary: [4.7/4.8 Regression] error: default argument
                    'std::vector<E>(std::initializer_list<E>{((const E*)(&
                    ._0)), 1u}, (*(const std::allocator<E>*)(&
                    std::allocator<E>())))' uses local variable '._0'
    Classification: Unclassified
           Product: gcc
           Version: 4.7.3
            Status: UNCONFIRMED
          Keywords: rejects-valid
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: redi@gcc.gnu.org


#include <initializer_list>

namespace std
{
    template<typename T>
        struct allocator
        { };

    template<typename T, typename Alloc = std::allocator<T> >
        struct vector
        {
            vector(std::initializer_list<T>, const Alloc& = Alloc()) { }
        };
}

void func() { }

enum E { ee };

struct C
{
    template<typename T>
        C(T, std::vector<E> = std::vector<E>({ ee }))
        { }
};

struct G
{
    void gen()
    {
        C c(&func);
    }
};


$ g++ -std=c++11 err.cc
err.cc: In constructor 'C::C(T, std::vector<E>) [with T = void (*)()]':
err.cc:31:18: error: default argument
'std::vector<E>(std::initializer_list<E>{((const E*)(& ._0)), 1u}, (*(const
std::allocator<E>*)(& std::allocator<E>())))' uses local variable '._0'
         C c(&func);
                  ^


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

* [Bug c++/56614] [4.7/4.8 Regression] error: default argument 'std::vector<E>(std::initializer_list<E>{((const E*)(& ._0)), 1u}, (*(const std::allocator<E>*)(& std::allocator<E>())))' uses local variable '._0'
  2013-03-13 14:46 [Bug c++/56614] New: [4.7/4.8 Regression] error: default argument 'std::vector<E>(std::initializer_list<E>{((const E*)(& ._0)), 1u}, (*(const std::allocator<E>*)(& std::allocator<E>())))' uses local variable '._0' redi at gcc dot gnu.org
@ 2013-03-13 16:48 ` paolo.carlini at oracle dot com
  2013-03-13 17:29 ` paolo.carlini at oracle dot com
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-03-13 16:48 UTC (permalink / raw)
  To: gcc-bugs


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

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2013-03-13
   Target Milestone|---                         |4.7.3
     Ever Confirmed|0                           |1
      Known to fail|                            |4.7.0

--- Comment #1 from Paolo Carlini <paolo.carlini at oracle dot com> 2013-03-13 16:47:56 UTC ---
Confirmed.


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

* [Bug c++/56614] [4.7/4.8 Regression] error: default argument 'std::vector<E>(std::initializer_list<E>{((const E*)(& ._0)), 1u}, (*(const std::allocator<E>*)(& std::allocator<E>())))' uses local variable '._0'
  2013-03-13 14:46 [Bug c++/56614] New: [4.7/4.8 Regression] error: default argument 'std::vector<E>(std::initializer_list<E>{((const E*)(& ._0)), 1u}, (*(const std::allocator<E>*)(& std::allocator<E>())))' uses local variable '._0' redi at gcc dot gnu.org
  2013-03-13 16:48 ` [Bug c++/56614] " paolo.carlini at oracle dot com
@ 2013-03-13 17:29 ` paolo.carlini at oracle dot com
  2013-03-13 17:37 ` redi at gcc dot gnu.org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-03-13 17:29 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #2 from Paolo Carlini <paolo.carlini at oracle dot com> 2013-03-13 17:29:02 UTC ---
A few details can be removed from the testcase:

#include <initializer_list>

struct vector
{
  vector(std::initializer_list<int>);
};

void func();

struct C
{
  template<typename T>
    C(T, vector = vector({}));
};

C c(func);


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

* [Bug c++/56614] [4.7/4.8 Regression] error: default argument 'std::vector<E>(std::initializer_list<E>{((const E*)(& ._0)), 1u}, (*(const std::allocator<E>*)(& std::allocator<E>())))' uses local variable '._0'
  2013-03-13 14:46 [Bug c++/56614] New: [4.7/4.8 Regression] error: default argument 'std::vector<E>(std::initializer_list<E>{((const E*)(& ._0)), 1u}, (*(const std::allocator<E>*)(& std::allocator<E>())))' uses local variable '._0' redi at gcc dot gnu.org
  2013-03-13 16:48 ` [Bug c++/56614] " paolo.carlini at oracle dot com
  2013-03-13 17:29 ` paolo.carlini at oracle dot com
@ 2013-03-13 17:37 ` redi at gcc dot gnu.org
  2013-03-14 10:22 ` jakub at gcc dot gnu.org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: redi at gcc dot gnu.org @ 2013-03-13 17:37 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> 2013-03-13 17:36:27 UTC ---
Ah, thanks. I reduced it from 300KLOC and apparently stopped too soon :)


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

* [Bug c++/56614] [4.7/4.8 Regression] error: default argument 'std::vector<E>(std::initializer_list<E>{((const E*)(& ._0)), 1u}, (*(const std::allocator<E>*)(& std::allocator<E>())))' uses local variable '._0'
  2013-03-13 14:46 [Bug c++/56614] New: [4.7/4.8 Regression] error: default argument 'std::vector<E>(std::initializer_list<E>{((const E*)(& ._0)), 1u}, (*(const std::allocator<E>*)(& std::allocator<E>())))' uses local variable '._0' redi at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2013-03-13 17:37 ` redi at gcc dot gnu.org
@ 2013-03-14 10:22 ` jakub at gcc dot gnu.org
  2013-03-14 13:09 ` jason at gcc dot gnu.org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2013-03-14 10:22 UTC (permalink / raw)
  To: gcc-bugs


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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org,
                   |                            |jason at gcc dot gnu.org

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> 2013-03-14 10:21:05 UTC ---
Started with http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=184199
aka PR39055.  If the testcase is valid, perhaps we need to special case the
std::initializer_list temporaries, or allow DECL_ARTIFICIAL except for this?


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

* [Bug c++/56614] [4.7/4.8 Regression] error: default argument 'std::vector<E>(std::initializer_list<E>{((const E*)(& ._0)), 1u}, (*(const std::allocator<E>*)(& std::allocator<E>())))' uses local variable '._0'
  2013-03-13 14:46 [Bug c++/56614] New: [4.7/4.8 Regression] error: default argument 'std::vector<E>(std::initializer_list<E>{((const E*)(& ._0)), 1u}, (*(const std::allocator<E>*)(& std::allocator<E>())))' uses local variable '._0' redi at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2013-03-14 10:22 ` jakub at gcc dot gnu.org
@ 2013-03-14 13:09 ` jason at gcc dot gnu.org
  2013-03-14 17:35 ` jason at gcc dot gnu.org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jason at gcc dot gnu.org @ 2013-03-14 13:09 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #5 from Jason Merrill <jason at gcc dot gnu.org> 2013-03-14 13:09:20 UTC ---
Author: jason
Date: Thu Mar 14 13:09:11 2013
New Revision: 196658

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=196658
Log:
    PR c++/56614
    * decl.c (local_variable_p_walkfn): Check DECL_ARTIFICIAL again.

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


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

* [Bug c++/56614] [4.7/4.8 Regression] error: default argument 'std::vector<E>(std::initializer_list<E>{((const E*)(& ._0)), 1u}, (*(const std::allocator<E>*)(& std::allocator<E>())))' uses local variable '._0'
  2013-03-13 14:46 [Bug c++/56614] New: [4.7/4.8 Regression] error: default argument 'std::vector<E>(std::initializer_list<E>{((const E*)(& ._0)), 1u}, (*(const std::allocator<E>*)(& std::allocator<E>())))' uses local variable '._0' redi at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2013-03-14 13:09 ` jason at gcc dot gnu.org
@ 2013-03-14 17:35 ` jason at gcc dot gnu.org
  2013-03-14 17:36 ` jason at gcc dot gnu.org
  2013-03-14 17:46 ` redi at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: jason at gcc dot gnu.org @ 2013-03-14 17:35 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #6 from Jason Merrill <jason at gcc dot gnu.org> 2013-03-14 17:35:03 UTC ---
Author: jason
Date: Thu Mar 14 17:34:55 2013
New Revision: 196662

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=196662
Log:
    PR c++/56614
    * decl.c (local_variable_p_walkfn): Check DECL_ARTIFICIAL again.

Added:
    branches/gcc-4_7-branch/gcc/testsuite/g++.dg/cpp0x/initlist-defarg1.C
Modified:
    branches/gcc-4_7-branch/gcc/cp/ChangeLog
    branches/gcc-4_7-branch/gcc/cp/decl.c


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

* [Bug c++/56614] [4.7/4.8 Regression] error: default argument 'std::vector<E>(std::initializer_list<E>{((const E*)(& ._0)), 1u}, (*(const std::allocator<E>*)(& std::allocator<E>())))' uses local variable '._0'
  2013-03-13 14:46 [Bug c++/56614] New: [4.7/4.8 Regression] error: default argument 'std::vector<E>(std::initializer_list<E>{((const E*)(& ._0)), 1u}, (*(const std::allocator<E>*)(& std::allocator<E>())))' uses local variable '._0' redi at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2013-03-14 17:35 ` jason at gcc dot gnu.org
@ 2013-03-14 17:36 ` jason at gcc dot gnu.org
  2013-03-14 17:46 ` redi at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: jason at gcc dot gnu.org @ 2013-03-14 17:36 UTC (permalink / raw)
  To: gcc-bugs


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

Jason Merrill <jason at gcc dot gnu.org> changed:

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

--- Comment #7 from Jason Merrill <jason at gcc dot gnu.org> 2013-03-14 17:35:53 UTC ---
Fixed.


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

* [Bug c++/56614] [4.7/4.8 Regression] error: default argument 'std::vector<E>(std::initializer_list<E>{((const E*)(& ._0)), 1u}, (*(const std::allocator<E>*)(& std::allocator<E>())))' uses local variable '._0'
  2013-03-13 14:46 [Bug c++/56614] New: [4.7/4.8 Regression] error: default argument 'std::vector<E>(std::initializer_list<E>{((const E*)(& ._0)), 1u}, (*(const std::allocator<E>*)(& std::allocator<E>())))' uses local variable '._0' redi at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2013-03-14 17:36 ` jason at gcc dot gnu.org
@ 2013-03-14 17:46 ` redi at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: redi at gcc dot gnu.org @ 2013-03-14 17:46 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #8 from Jonathan Wakely <redi at gcc dot gnu.org> 2013-03-14 17:45:58 UTC ---
Thanks, Jason


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

end of thread, other threads:[~2013-03-14 17:46 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-13 14:46 [Bug c++/56614] New: [4.7/4.8 Regression] error: default argument 'std::vector<E>(std::initializer_list<E>{((const E*)(& ._0)), 1u}, (*(const std::allocator<E>*)(& std::allocator<E>())))' uses local variable '._0' redi at gcc dot gnu.org
2013-03-13 16:48 ` [Bug c++/56614] " paolo.carlini at oracle dot com
2013-03-13 17:29 ` paolo.carlini at oracle dot com
2013-03-13 17:37 ` redi at gcc dot gnu.org
2013-03-14 10:22 ` jakub at gcc dot gnu.org
2013-03-14 13:09 ` jason at gcc dot gnu.org
2013-03-14 17:35 ` jason at gcc dot gnu.org
2013-03-14 17:36 ` jason at gcc dot gnu.org
2013-03-14 17:46 ` redi at gcc dot gnu.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).