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++/69057] New: constexpr static variable template assertion segmentation fault


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69057

            Bug ID: 69057
           Summary: constexpr static variable template assertion
                    segmentation fault
           Product: gcc
           Version: 5.3.0
            Status: UNCONFIRMED
          Severity: critical
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: vittorio.romeo at outlook dot com
  Target Milestone: ---

gcc.godbolt.org example: https://goo.gl/yGCVOB

---

#include <cassert>

using GLenum = unsigned int;

template <typename T>
inline constexpr auto from_enum(const T& x) noexcept
{
    // Comment this line to prevent segmentation fault:
    assert(true);
    // ------------------------------------------------

    return (GLenum)x;
}

enum class buffer_target : GLenum
{
    array
};

struct vbo
{
    static constexpr GLenum target_value{from_enum(buffer_target::array)};
    GLenum x{target_value};
};

int main()
{
    return 0;
}

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