This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/53464] New: Invalid default value for non-type template parameter is accepted


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

             Bug #: 53464
           Summary: Invalid default value for non-type template parameter
                    is accepted
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: schwan@uni-mainz.de


Consider the following code:

template <int value>
struct bar
{
    static constexpr int get()
    {
        return value;
    }
};

template <typename A, int value = A::get()>
struct foo
{
};

int main()
{
    typedef foo<bar<0>> type;

    return 0;
}

It should be rejected, since A::get() is not a "converted constant expression"
as discussed in http://stackoverflow.com/questions/10721130 . I tested this
with the GCC from svn.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]