Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for GCC 5.4? #45

Closed
manhnt9 opened this issue Aug 9, 2017 · 5 comments
Closed

Support for GCC 5.4? #45

manhnt9 opened this issue Aug 9, 2017 · 5 comments

Comments

@manhnt9
Copy link

manhnt9 commented Aug 9, 2017

I know 5.4 is not officially supported but I still report for further development.
Please support it if possible. Compile errors on Linux 64-bit gcc 5.4.0

enum.h:577:1: error: ‘namespace’ definition is not allowed here
namespace better_enums {
^
enum.h:106:28: note: in definition of macro ‘BETTER_ENUMS_ID’
#define BETTER_ENUMS_ID(x) x
^
enum.h:1039:21: note: in expansion of macro ‘BETTER_ENUMS_TYPE’
BETTER_ENUMS_ID(BETTER_ENUMS_TYPE(
^
main.cpp:11:3: note: in expansion of macro ‘BETTER_ENUM’
BETTER_ENUM(Word, int, Hello, World)
^
enum.h:247:15: error: local class ‘class main()::Word’ shall not have static data member ‘constexpr const size_t main()::Word::_size_constant’ [-fpermissive]
4, 3, 2, 1))
^
enum.h:106:28: note: in definition of macro ‘BETTER_ENUMS_ID’
#define BETTER_ENUMS_ID(x) x
^
enum.h:637:9: note: in expansion of macro ‘BETTER_ENUMS_ID’
BETTER_ENUMS_ID(BETTER_ENUMS_PP_COUNT(VA_ARGS));
^
enum.h:243:5: note: in expansion of macro ‘BETTER_ENUMS_ID’
BETTER_ENUMS_ID(BETTER_ENUMS_PP_COUNT_IMPL(VA_ARGS, 64, 63, 62, 61, 60,
^
enum.h:243:21: note: in expansion of macro ‘BETTER_ENUMS_PP_COUNT_IMPL’
BETTER_ENUMS_ID(BETTER_ENUMS_PP_COUNT_IMPL(VA_ARGS, 64, 63, 62, 61, 60,
^
enum.h:637:25: note: in expansion of macro ‘BETTER_ENUMS_PP_COUNT’
BETTER_ENUMS_ID(BETTER_ENUMS_PP_COUNT(VA_ARGS));
^
enum.h:1039:21: note: in expansion of macro ‘BETTER_ENUMS_TYPE’
BETTER_ENUMS_ID(BETTER_ENUMS_TYPE(
^
main.cpp:11:3: note: in expansion of macro ‘BETTER_ENUM’
BETTER_ENUM(Word, int, Hello, World)
^
enum.h:665:1: error: ‘namespace’ definition is not allowed here
namespace better_enums {
^
enum.h:106:28: note: in definition of macro ‘BETTER_ENUMS_ID’
#define BETTER_ENUMS_ID(x) x
^
enum.h:1039:21: note: in expansion of macro ‘BETTER_ENUMS_TYPE’
BETTER_ENUMS_ID(BETTER_ENUMS_TYPE(
^
main.cpp:11:3: note: in expansion of macro ‘BETTER_ENUM’
BETTER_ENUM(Word, int, Hello, World)
^
enum.h:683:1: error: a function-definition is not allowed here before ‘{’ token
{
^
enum.h:106:28: note: in definition of macro ‘BETTER_ENUMS_ID’
#define BETTER_ENUMS_ID(x) x
^
enum.h:1039:21: note: in expansion of macro ‘BETTER_ENUMS_TYPE’
BETTER_ENUMS_ID(BETTER_ENUMS_TYPE(
^
main.cpp:11:3: note: in expansion of macro ‘BETTER_ENUM’
BETTER_ENUM(Word, int, Hello, World)
^
enum.h:688:23: error: qualified-id in declaration before ‘(’ token
Enum::_from_value_loop(Enum::_integral value, std::size_t index)
^
enum.h:106:28: note: in definition of macro ‘BETTER_ENUMS_ID’
#define BETTER_ENUMS_ID(x) x
^
enum.h:1039:21: note: in expansion of macro ‘BETTER_ENUMS_TYPE’
BETTER_ENUMS_ID(BETTER_ENUMS_TYPE(
^
main.cpp:11:3: note: in expansion of macro ‘BETTER_ENUM’
BETTER_ENUM(Word, int, Hello, World)
^
enum.h:699:24: error: qualified-id in declaration before ‘(’ token
Enum::_from_string_loop(const char name, std::size_t index)
^
enum.h:106:28: note: in definition of macro ‘BETTER_ENUMS_ID’
#define BETTER_ENUMS_ID(x) x
^
enum.h:1039:21: note: in expansion of macro ‘BETTER_ENUMS_TYPE’
BETTER_ENUMS_ID(BETTER_ENUMS_TYPE(
^
main.cpp:11:3: note: in expansion of macro ‘BETTER_ENUM’
BETTER_ENUM(Word, int, Hello, World)
^
enum.h:710:31: error: qualified-id in declaration before ‘(’ token
Enum::from_string_nocase_loop(const char *name, std::size_t index)
^
enum.h:106:28: note: in definition of macro ‘BETTER_ENUMS_ID’
#define BETTER_ENUMS_ID(x) x
^
enum.h:1039:21: note: in expansion of macro ‘BETTER_ENUMS_TYPE’
BETTER_ENUMS_ID(BETTER_ENUMS_TYPE(
^
main.cpp:11:3: note: in expansion of macro ‘BETTER_ENUM’
BETTER_ENUM(Word, int, Hello, World)
^
enum.h:720:66: error: qualified-id in declaration before ‘(’ token
BETTER_ENUMS_CONSTEXPR
inline Enum::_integral Enum::_to_integral() const
^
enum.h:106:28: note: in definition of macro ‘BETTER_ENUMS_ID’
#define BETTER_ENUMS_ID(x) x
^
enum.h:1039:21: note: in expansion of macro ‘BETTER_ENUMS_TYPE’
BETTER_ENUMS_ID(BETTER_ENUMS_TYPE(
^
main.cpp:11:3: note: in expansion of macro ‘BETTER_ENUM’
BETTER_ENUM(Word, int, Hello, World)
^
enum.h:726:31: error: qualified-id in declaration before ‘(’ token
Enum::_from_integral_unchecked(_integral value)
^
enum.h:106:28: note: in definition of macro ‘BETTER_ENUMS_ID’
#define BETTER_ENUMS_ID(x) x
^
enum.h:1039:21: note: in expansion of macro ‘BETTER_ENUMS_TYPE’
BETTER_ENUMS_ID(BETTER_ENUMS_TYPE(
^
main.cpp:11:3: note: in expansion of macro ‘BETTER_ENUM’
BETTER_ENUM(Word, int, Hello, World)
^
enum.h:732:29: error: qualified-id in declaration before ‘(’ token
Enum::_from_integral_nothrow(integral value)
^
enum.h:106:28: note: in definition of macro ‘BETTER_ENUMS_ID’
#define BETTER_ENUMS_ID(x) x
^
enum.h:1039:21: note: in expansion of macro ‘BETTER_ENUMS_TYPE’
BETTER_ENUMS_ID(BETTER_ENUMS_TYPE(
^
main.cpp:11:3: note: in expansion of macro ‘BETTER_ENUM’
BETTER_ENUM(Word, int, Hello, World)
^
enum.h:740:57: error: qualified-id in declaration before ‘(’ token
BETTER_ENUMS_CONSTEXPR
inline Enum Enum::_from_integral(_integral value)
^
enum.h:106:28: note: in definition of macro ‘BETTER_ENUMS_ID’
#define BETTER_ENUMS_ID(x) x
^
enum.h:739:1: note: in expansion of macro ‘BETTER_ENUMS_IF_EXCEPTIONS’
BETTER_ENUMS_IF_EXCEPTIONS(
^
enum.h:1039:21: note: in expansion of macro ‘BETTER_ENUMS_TYPE’
BETTER_ENUMS_ID(BETTER_ENUMS_TYPE(
^
main.cpp:11:3: note: in expansion of macro ‘BETTER_ENUM’
BETTER_ENUM(Word, int, Hello, World)
^
enum.h:748:54: error: qualified-id in declaration before ‘(’ token
ToStringConstexpr inline const char
Enum::_to_string() const
^
enum.h:106:28: note: in definition of macro ‘BETTER_ENUMS_ID’
#define BETTER_ENUMS_ID(x) x
^
enum.h:1039:21: note: in expansion of macro ‘BETTER_ENUMS_TYPE’
BETTER_ENUMS_ID(BETTER_ENUMS_TYPE(
^
main.cpp:11:3: note: in expansion of macro ‘BETTER_ENUM’
BETTER_ENUM(Word, int, Hello, World)
^
enum.h:758:27: error: qualified-id in declaration before ‘(’ token
Enum::from_string_nothrow(const char *name)
^
enum.h:106:28: note: in definition of macro ‘BETTER_ENUMS_ID’
#define BETTER_ENUMS_ID(x) x
^
enum.h:1039:21: note: in expansion of macro ‘BETTER_ENUMS_TYPE’
BETTER_ENUMS_ID(BETTER_ENUMS_TYPE(
^
main.cpp:11:3: note: in expansion of macro ‘BETTER_ENUM’
BETTER_ENUM(Word, int, Hello, World)
^
enum.h:766:55: error: qualified-id in declaration before ‘(’ token
BETTER_ENUMS_CONSTEXPR
inline Enum Enum::_from_string(const char name)
^
enum.h:106:28: note: in definition of macro ‘BETTER_ENUMS_ID’
#define BETTER_ENUMS_ID(x) x
^
enum.h:765:1: note: in expansion of macro ‘BETTER_ENUMS_IF_EXCEPTIONS’
BETTER_ENUMS_IF_EXCEPTIONS(
^
enum.h:1039:21: note: in expansion of macro ‘BETTER_ENUMS_TYPE’
BETTER_ENUMS_ID(BETTER_ENUMS_TYPE(
^
main.cpp:11:3: note: in expansion of macro ‘BETTER_ENUM’
BETTER_ENUM(Word, int, Hello, World)
^
enum.h:775:34: error: qualified-id in declaration before ‘(’ token
Enum::from_string_nocase_nothrow(const char *name)
^
enum.h:106:28: note: in definition of macro ‘BETTER_ENUMS_ID’
#define BETTER_ENUMS_ID(x) x
^
enum.h:1039:21: note: in expansion of macro ‘BETTER_ENUMS_TYPE’
BETTER_ENUMS_ID(BETTER_ENUMS_TYPE(
^
main.cpp:11:3: note: in expansion of macro ‘BETTER_ENUM’
BETTER_ENUM(Word, int, Hello, World)
^
enum.h:783:62: error: qualified-id in declaration before ‘(’ token
BETTER_ENUMS_CONSTEXPR
inline Enum Enum::from_string_nocase(const char *name)
^
enum.h:106:28: note: in definition of macro ‘BETTER_ENUMS_ID’
#define BETTER_ENUMS_ID(x) x
^
enum.h:782:1: note: in expansion of macro ‘BETTER_ENUMS_IF_EXCEPTIONS’
BETTER_ENUMS_IF_EXCEPTIONS(
^
enum.h:1039:21: note: in expansion of macro ‘BETTER_ENUMS_TYPE’
BETTER_ENUMS_ID(BETTER_ENUMS_TYPE(
^
main.cpp:11:3: note: in expansion of macro ‘BETTER_ENUM’
BETTER_ENUM(Word, int, Hello, World)
^
enum.h:792:52: error: qualified-id in declaration before ‘(’ token
BETTER_ENUMS_CONSTEXPR
inline bool Enum::_is_valid(integral value)
^
enum.h:106:28: note: in definition of macro ‘BETTER_ENUMS_ID’
#define BETTER_ENUMS_ID(x) x
^
enum.h:1039:21: note: in expansion of macro ‘BETTER_ENUMS_TYPE’
BETTER_ENUMS_ID(BETTER_ENUMS_TYPE(
^
main.cpp:11:3: note: in expansion of macro ‘BETTER_ENUM’
BETTER_ENUM(Word, int, Hello, World)
^
enum.h:797:52: error: qualified-id in declaration before ‘(’ token
BETTER_ENUMS_CONSTEXPR
inline bool Enum::is_valid(const char *name)
^
enum.h:106:28: note: in definition of macro ‘BETTER_ENUMS_ID’
#define BETTER_ENUMS_ID(x) x
^
enum.h:1039:21: note: in expansion of macro ‘BETTER_ENUMS_TYPE’
BETTER_ENUMS_ID(BETTER_ENUMS_TYPE(
^
main.cpp:11:3: note: in expansion of macro ‘BETTER_ENUM’
BETTER_ENUM(Word, int, Hello, World)
^
enum.h:802:59: error: qualified-id in declaration before ‘(’ token
BETTER_ENUMS_CONSTEXPR
inline bool Enum::is_valid_nocase(const char *name)
^
enum.h:106:28: note: in definition of macro ‘BETTER_ENUMS_ID’
#define BETTER_ENUMS_ID(x) x
^
enum.h:1039:21: note: in expansion of macro ‘BETTER_ENUMS_TYPE’
BETTER_ENUMS_ID(BETTER_ENUMS_TYPE(
^
main.cpp:11:3: note: in expansion of macro ‘BETTER_ENUM’
BETTER_ENUM(Word, int, Hello, World)
^
enum.h:807:55: error: qualified-id in declaration before ‘(’ token
BETTER_ENUMS_CONSTEXPR
inline const char
Enum::name()
^
enum.h:106:28: note: in definition of macro ‘BETTER_ENUMS_ID’
#define BETTER_ENUMS_ID(x) x
^
enum.h:1039:21: note: in expansion of macro ‘BETTER_ENUMS_TYPE’
BETTER_ENUMS_ID(BETTER_ENUMS_TYPE(
^
main.cpp:11:3: note: in expansion of macro ‘BETTER_ENUM’
BETTER_ENUM(Word, int, Hello, World)
^
enum.h:812:67: error: qualified-id in declaration before ‘(’ token
BETTER_ENUMS_CONSTEXPR
inline Enum::_value_iterable Enum::_values()
^
enum.h:106:28: note: in definition of macro ‘BETTER_ENUMS_ID’
#define BETTER_ENUMS_ID(x) x
^
enum.h:1039:21: note: in expansion of macro ‘BETTER_ENUMS_TYPE’
BETTER_ENUMS_ID(BETTER_ENUMS_TYPE(
^
main.cpp:11:3: note: in expansion of macro ‘BETTER_ENUM’
BETTER_ENUM(Word, int, Hello, World)
^
enum.h:817:59: error: qualified-id in declaration before ‘(’ token
ToStringConstexpr inline Enum::_name_iterable Enum::_names()
^
enum.h:106:28: note: in definition of macro ‘BETTER_ENUMS_ID’
#define BETTER_ENUMS_ID(x) x
^
enum.h:1039:21: note: in expansion of macro ‘BETTER_ENUMS_TYPE’
BETTER_ENUMS_ID(BETTER_ENUMS_TYPE(
^
main.cpp:11:3: note: in expansion of macro ‘BETTER_ENUM’
BETTER_ENUM(Word, int, Hello, World)
^
enum.h:956:32: error: qualified-id in declaration before ‘(’ token
inline int Enum::initialize()
^
enum.h:106:28: note: in definition of macro ‘BETTER_ENUMS_ID’
#define BETTER_ENUMS_ID(x) x
^
enum.h:824:1: note: in expansion of macro ‘BETTER_ENUMS_DO_DEFINE_INITIALIZE’
DefineInitialize(Enum)
^
enum.h:1039:21: note: in expansion of macro ‘BETTER_ENUMS_TYPE’
BETTER_ENUMS_ID(BETTER_ENUMS_TYPE(
^
enum.h:1046:9: note: in expansion of macro ‘BETTER_ENUMS_DEFAULT_DEFINE_INITIALIZE’
BETTER_ENUMS_DEFAULT_DEFINE_INITIALIZE,
^
main.cpp:11:3: note: in expansion of macro ‘BETTER_ENUM’
BETTER_ENUM(Word, int, Hello, World)
^
enum.h:827:5: error: a function-definition is not allowed here before ‘{’ token
{ return a._to_integral() == b._to_integral(); }
^
enum.h:106:28: note: in definition of macro ‘BETTER_ENUMS_ID’
#define BETTER_ENUMS_ID(x) x
^
enum.h:1039:21: note: in expansion of macro ‘BETTER_ENUMS_TYPE’
BETTER_ENUMS_ID(BETTER_ENUMS_TYPE(
^
main.cpp:11:3: note: in expansion of macro ‘BETTER_ENUM’
BETTER_ENUM(Word, int, Hello, World)
^
enum.h:829:5: error: a function-definition is not allowed here before ‘{’ token
{ return a._to_integral() != b._to_integral(); }
^
enum.h:106:28: note: in definition of macro ‘BETTER_ENUMS_ID’
#define BETTER_ENUMS_ID(x) x
^
enum.h:1039:21: note: in expansion of macro ‘BETTER_ENUMS_TYPE’
BETTER_ENUMS_ID(BETTER_ENUMS_TYPE(
^
main.cpp:11:3: note: in expansion of macro ‘BETTER_ENUM’
BETTER_ENUM(Word, int, Hello, World)
^
enum.h:831:5: error: a function-definition is not allowed here before ‘{’ token
{ return a._to_integral() < b._to_integral(); }
^
enum.h:106:28: note: in definition of macro ‘BETTER_ENUMS_ID’
#define BETTER_ENUMS_ID(x) x
^
enum.h:1039:21: note: in expansion of macro ‘BETTER_ENUMS_TYPE’
BETTER_ENUMS_ID(BETTER_ENUMS_TYPE(
^
main.cpp:11:3: note: in expansion of macro ‘BETTER_ENUM’
BETTER_ENUM(Word, int, Hello, World)
^
enum.h:833:5: error: a function-definition is not allowed here before ‘{’ token
{ return a._to_integral() <= b._to_integral(); }
^
enum.h:106:28: note: in definition of macro ‘BETTER_ENUMS_ID’
#define BETTER_ENUMS_ID(x) x
^
enum.h:1039:21: note: in expansion of macro ‘BETTER_ENUMS_TYPE’
BETTER_ENUMS_ID(BETTER_ENUMS_TYPE(
^
main.cpp:11:3: note: in expansion of macro ‘BETTER_ENUM’
BETTER_ENUM(Word, int, Hello, World)
^
enum.h:835:5: error: a function-definition is not allowed here before ‘{’ token
{ return a._to_integral() > b._to_integral(); }
^
enum.h:106:28: note: in definition of macro ‘BETTER_ENUMS_ID’
#define BETTER_ENUMS_ID(x) x
^
enum.h:1039:21: note: in expansion of macro ‘BETTER_ENUMS_TYPE’
BETTER_ENUMS_ID(BETTER_ENUMS_TYPE(
^
main.cpp:11:3: note: in expansion of macro ‘BETTER_ENUM’
BETTER_ENUM(Word, int, Hello, World)
^
enum.h:837:5: error: a function-definition is not allowed here before ‘{’ token
{ return a._to_integral() >= b._to_integral(); }
^
enum.h:106:28: note: in definition of macro ‘BETTER_ENUMS_ID’
#define BETTER_ENUMS_ID(x) x
^
enum.h:1039:21: note: in expansion of macro ‘BETTER_ENUMS_TYPE’
BETTER_ENUMS_ID(BETTER_ENUMS_TYPE(
^
main.cpp:11:3: note: in expansion of macro ‘BETTER_ENUM’
BETTER_ENUM(Word, int, Hello, World)
^

@manhnt9
Copy link
Author

manhnt9 commented Aug 9, 2017

strange, I installed clang 3.9 and get the same errors. My code is just: BETTER_ENUM(Word, int, Hello, World)

@aantron
Copy link
Owner

aantron commented Aug 9, 2017

Can you show a complete (perhaps minimal) example that causes this?

@manhnt9
Copy link
Author

manhnt9 commented Aug 9, 2017

I tested on a independent source file, there was no error, but I couldn't integrate it to my current project. Do you have any ideas about what may cause the the errors?

@aantron
Copy link
Owner

aantron commented Aug 9, 2017

Is the enum declared inside class, or is the file that declares it included inside a class (doesn't look so from the error trace, but just in case)?

It's been a while, so I'm not super familiar with GCC error messages anymore, but IIRC this is the main limitation of Better Enums. See https://github.com/aantron/better-enums#limitations.

@aantron
Copy link
Owner

aantron commented Aug 17, 2019

Closing. Please reopen if this was not solved and you would like to look into it again.

@aantron aantron closed this as completed Aug 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants