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: unassig...@gcc.gnu.org

        ReportedBy: r...@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);

                  ^

Reply via email to