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++/50837] New: [c++0x] static_assert and constexpr in template class


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

             Bug #: 50837
           Summary: [c++0x] static_assert and constexpr in template class
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: trashyankes@wp.pl
             Build: MinGW 4.6.0 20110210; MinGW 4.7.0 20110815


error: `'static constexpr bool z<T>::test_constexpr() [with T = int]' cannot
appear in a constant-expression`
adding `z<T>::` before `test_constexpr` fix it
------------------------------------------------------
template<class T>
struct z
{
    static constexpr bool test_constexpr()
    {
        return true;
    }
    static bool test()
    {
        static_assert(test_constexpr(), "test1");//error here
        return true;
    }
};
int main()
{
    z<int>::test();
}
------------------------------------------------------


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