| 1 |
// PR c++/69057 |
| 2 |
// { dg-do compile { target c++14 } } |
| 3 |
// { dg-skip-if "requires hosted libstdc++ for cassert" { ! hostedlib } } |
| 4 |
|
| 5 |
#include <cassert> |
| 6 |
|
| 7 |
using GLenum = unsigned int; |
| 8 |
|
| 9 |
template <typename T> |
| 10 |
inline constexpr auto from_enum(const T& x) noexcept |
| 11 |
{ |
| 12 |
// Comment this line to prevent segmentation fault: |
| 13 |
assert(true); |
| 14 |
// ------------------------------------------------ |
| 15 |
|
| 16 |
return (GLenum)x; |
| 17 |
} |
| 18 |
|
| 19 |
enum class buffer_target : GLenum |
| 20 |
{ |
| 21 |
array |
| 22 |
}; |
| 23 |
|
| 24 |
struct vbo |
| 25 |
{ |
| 26 |
static constexpr GLenum target_value{from_enum(buffer_target::array)}; |
| 27 |
GLenum x{target_value}; |
| 28 |
}; |