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

--- Comment #2 from Jamaika <lukaszcz18 at wp dot pl> ---
In file included from test_enums.cpp:1:
metaref/enums.hpp: In function 'constexpr std::string_view
metaref::enum_name(T)':
metaref/enums.hpp:16:34: error: 'meta' in namespace 'std' does not name a type
[-Wtemplate-body]
   16 |     template for (constexpr std::meta::info member :
std::define_static_array(std::meta::enumerators_of(^^T))) {
      |                                  ^~~~
metaref/enums.hpp:20:6: error: expected ':' before 'return' [-Wtemplate-body]
   20 |     }
      |      ^
      |      :
   21 |
   22 |     return "";
      |     ~~~~~~
metaref/enums.hpp:22:5: error: expected primary-expression before 'return'
[-Wtemplate-body]
   22 |     return "";
      |     ^~~~~~
metaref/enums.hpp:20:6: error: expected ')' before 'return' [-Wtemplate-body]
   20 |     }
      |      ^
      |      )
   21 |
   22 |     return "";
      |     ~~~~~~
metaref/enums.hpp:16:18: note: to match this '('
   16 |     template for (constexpr std::meta::info member :
std::define_static_array(std::meta::enumerators_of(^^T))) {
      |                  ^
metaref/enums.hpp:23:1: error: no return statement in 'constexpr' function
returning non-void [-Wtemplate-body]
   23 | }
      | ^
metaref/enums.hpp: In function 'constexpr std::optional<_Tp>
metaref::enum_from_name(std::string_view)':
metaref/enums.hpp:29:34: error: 'meta' in namespace 'std' does not name a type
[-Wtemplate-body]
   29 |     template for (constexpr std::meta::info member :
std::define_static_array(std::meta::enumerators_of(^^T))) {
      |                                  ^~~~
metaref/enums.hpp:33:6: error: expected ':' before 'return' [-Wtemplate-body]
   33 |     }
      |      ^
      |      :
   34 |
   35 |     return std::nullopt;
      |     ~~~~~~
metaref/enums.hpp:35:5: error: expected primary-expression before 'return'
[-Wtemplate-body]
   35 |     return std::nullopt;
      |     ^~~~~~
metaref/enums.hpp:33:6: error: expected ')' before 'return' [-Wtemplate-body]
   33 |     }
      |      ^
      |      )
   34 |
   35 |     return std::nullopt;
      |     ~~~~~~
metaref/enums.hpp:29:18: note: to match this '('
   29 |     template for (constexpr std::meta::info member :
std::define_static_array(std::meta::enumerators_of(^^T))) {
      |                  ^
metaref/enums.hpp: At global scope:
metaref/enums.hpp:46:48: error: 'std::meta' has not been declared
   46 | constexpr inline std::size_t enum_count =
std::meta::enumerators_of(^^T).size();
      |                                                ^~~~
metaref/enums.hpp:46:69: error: reflection is only available with
'-freflection'
   46 | constexpr inline std::size_t enum_count =
std::meta::enumerators_of(^^T).size();
      |                                                                     ^~
metaref/enums.hpp: In lambda function:
metaref/enums.hpp:54:15: error: 'std::meta' has not been declared
[-Wtemplate-body]
   54 |     for (std::meta::info member : std::meta::enumerators_of(^^T)) {
      |               ^~~~
metaref/enums.hpp:58:5: error: expected primary-expression before 'return'
[-Wtemplate-body]
   58 |     return names;
      |     ^~~~~~
metaref/enums.hpp:56:6: error: expected ';' before 'return' [-Wtemplate-body]
   56 |     }
      |      ^
      |      ;
   57 |
   58 |     return names;
      |     ~~~~~~
metaref/enums.hpp:58:5: error: expected primary-expression before 'return'
[-Wtemplate-body]
   58 |     return names;
      |     ^~~~~~
metaref/enums.hpp:56:6: error: expected ')' before 'return' [-Wtemplate-body]
   56 |     }
      |      ^
      |      )
   57 |
   58 |     return names;
      |     ~~~~~~
metaref/enums.hpp:54:9: note: to match this '('
   54 |     for (std::meta::info member : std::meta::enumerators_of(^^T)) {
      |         ^
metaref/enums.hpp: In lambda function:
metaref/enums.hpp:67:15: error: 'std::meta' has not been declared
[-Wtemplate-body]
   67 |     for (std::meta::info member : std::meta::enumerators_of(^^T)) {
      |               ^~~~
metaref/enums.hpp:71:5: error: expected primary-expression before 'return'
[-Wtemplate-body]
   71 |     return values;
      |     ^~~~~~
metaref/enums.hpp:69:6: error: expected ';' before 'return' [-Wtemplate-body]
   69 |     }
      |      ^
      |      ;
   70 |
   71 |     return values;
      |     ~~~~~~
metaref/enums.hpp:71:5: error: expected primary-expression before 'return'
[-Wtemplate-body]
   71 |     return values;
      |     ^~~~~~
metaref/enums.hpp:69:6: error: expected ')' before 'return' [-Wtemplate-body]
   69 |     }
      |      ^
      |      )
   70 |
   71 |     return values;
      |     ~~~~~~
metaref/enums.hpp:67:9: note: to match this '('
   67 |     for (std::meta::info member : std::meta::enumerators_of(^^T)) {
      |         ^
metaref/enums.hpp: In instantiation of 'constexpr std::string_view
metaref::enum_name(T) [with T = {anonymous}::Color; std::string_view =
std::basic_string_view<char>]':
test_enums.cpp:8:37:   required from here
    8 |     static_assert(metaref::enum_name(Green) == "Green");
      |                   ~~~~~~~~~~~~~~~~~~^~~~~~~
metaref/enums.hpp:23:1: error: no return statement in 'constexpr' function
returning non-void
   23 | }
      | ^
test_enums.cpp: At global scope:
test_enums.cpp:8:45: error: non-constant condition for static assertion
    8 |     static_assert(metaref::enum_name(Green) == "Green");
      |                   ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
test_enums.cpp:9:43: error: non-constant condition for static assertion
    9 |     static_assert(metaref::enum_name(Red) == "Red");
      |                   ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
test_enums.cpp:10:44: error: non-constant condition for static assertion
   10 |     static_assert(metaref::enum_name(Blue) == "Blue");
      |                   ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~
metaref/enums.hpp: In instantiation of 'constexpr std::string_view
metaref::enum_name(T) [with T = {anonymous}::Shade; std::string_view =
std::basic_string_view<char>]':
test_enums.cpp:14:37:   required from here
   14 |     static_assert(metaref::enum_name(Shade::green) == "green");
      |                   ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~
metaref/enums.hpp:23:1: error: no return statement in 'constexpr' function
returning non-void
   23 | }
      | ^
test_enums.cpp:14:52: error: non-constant condition for static assertion
   14 |     static_assert(metaref::enum_name(Shade::green) == "green");
      |                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
test_enums.cpp:15:54: error: non-constant condition for static assertion
   15 |     static_assert(metaref::enum_name(Shade::crimson) == "red"); //
first one declared win
      |                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
test_enums.cpp:16:53: error: non-constant condition for static assertion
   16 |     static_assert(metaref::enum_name(Shade{6}).empty());
      |                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
metaref/enums.hpp: In instantiation of 'constexpr std::string_view
metaref::enum_name(T) [with T = {anonymous}::Sparse; std::string_view =
std::basic_string_view<char>]':
test_enums.cpp:20:37:   required from here
   20 |     static_assert(metaref::enum_name(Sparse::neg) == "neg");
      |                   ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
metaref/enums.hpp:23:1: error: no return statement in 'constexpr' function
returning non-void
   23 | }
      | ^
test_enums.cpp:20:51: error: non-constant condition for static assertion
   20 |     static_assert(metaref::enum_name(Sparse::neg) == "neg");
      |                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
test_enums.cpp:21:55: error: non-constant condition for static assertion
   21 |     static_assert(metaref::enum_name(Sparse::hundred) == "hundred");
      |                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
test_enums.cpp:22:51: error: non-constant condition for static assertion
   22 |     static_assert(metaref::enum_name(Sparse::big) == "big");
      |                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
metaref/enums.hpp: In instantiation of 'constexpr std::string_view
metaref::enum_name(T) [with T = {anonymous}::Device::State; std::string_view =
std::basic_string_view<char>]':
test_enums.cpp:26:37:   required from here
   26 |     static_assert(metaref::enum_name(Device::State::off) == "off");
      |                   ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
metaref/enums.hpp:23:1: error: no return statement in 'constexpr' function
returning non-void
   23 | }
      | ^
test_enums.cpp:26:58: error: non-constant condition for static assertion
   26 |     static_assert(metaref::enum_name(Device::State::off) == "off");
      |                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
test_enums.cpp:27:57: error: non-constant condition for static assertion
   27 |     static_assert(metaref::enum_name(Device::State::on) == "on");
      |                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
metaref/enums.hpp: In instantiation of 'constexpr std::optional<_Tp>
metaref::enum_from_name(std::string_view) [with T = {anonymous}::Shade;
std::string_view = std::basic_string_view<char>]':
test_enums.cpp:29:49:   required from here
   29 |     static_assert(metaref::enum_from_name<Shade>("green") ==
Shade::green);
      |                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~
metaref/enums.hpp:36:1: error: no return statement in 'constexpr' function
returning non-void
   36 | }
      | ^
test_enums.cpp:29:59: error: non-constant condition for static assertion
   29 |     static_assert(metaref::enum_from_name<Shade>("green") ==
Shade::green);
      |                  
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
test_enums.cpp:30:61: error: non-constant condition for static assertion
   30 |     static_assert(metaref::enum_from_name<Shade>("crimson") ==
Shade::red);
      |                  
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
test_enums.cpp:31:19: error: non-constant condition for static assertion
   31 |    
static_assert(!metaref::enum_from_name<Shade>("purple").has_value());
      |                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
metaref/enums.hpp: In instantiation of 'constexpr std::optional<_Tp>
metaref::enum_from_name(std::string_view) [with T = {anonymous}::Color;
std::string_view = std::basic_string_view<char>]':
test_enums.cpp:33:49:   required from here
   33 |     static_assert(metaref::enum_from_name<Color>("Red") == Color::Red);
      |                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
metaref/enums.hpp:36:1: error: no return statement in 'constexpr' function
returning non-void
   36 | }
      | ^
test_enums.cpp:33:57: error: non-constant condition for static assertion
   33 |     static_assert(metaref::enum_from_name<Color>("Red") == Color::Red);
      |                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
test_enums.cpp:35:46: error: non-constant condition for static assertion
   35 |     static_assert(metaref::enum_count<Color> == 3);
      |                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
test_enums.cpp:36:46: error: non-constant condition for static assertion
   36 |     static_assert(metaref::enum_count<Shade> == 4);
      |                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
test_enums.cpp:47:41: error: non-constant condition for static assertion
   47 |     static_assert(metaref::enum_contains(Shade::green));
      |                   ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~
test_enums.cpp:48:41: error: non-constant condition for static assertion
   48 |     static_assert(metaref::enum_contains(Shade::crimson));
      |                   ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~
test_enums.cpp:49:19: error: non-constant condition for static assertion
   49 |     static_assert(!metaref::enum_contains(Shade{3}));
      |                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
test_enums.cpp:50:19: error: non-constant condition for static assertion
   50 |     static_assert(!metaref::enum_contains(Shade{6}));
      |                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
metaref/enums.hpp: In function 'constexpr std::string_view
metaref::enum_name(T) [with T = {anonymous}::Shade]':
metaref/enums.hpp:23:1: warning: control reaches end of non-void function
[-Wreturn-type]
   23 | }
      | ^
metaref/enums.hpp: In function 'constexpr std::optional<_Tp>
metaref::enum_from_name(std::string_view) [with T = {anonymous}::Shade]':
metaref/enums.hpp:36:1: warning: control reaches end of non-void function
[-Wreturn-type]
   36 | }
      | ^

Reply via email to