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

Fix re-declared scoped enum as unscoped (Causes issues with some compilers) #13180

Merged
merged 1 commit into from
May 7, 2018

Conversation

donaloconnor
Copy link
Contributor

@donaloconnor donaloconnor commented May 6, 2018

MSVC fails to compile with the changes made in #10742

The problem is enum types were changed to scoped (enum class) but in some places enum as an unscoped is used.

This is a very simple fix and I've tested it.

Edit: Had to remove enum altogether - enum class doesn't compile on clang.

src/rest.cpp Outdated
@@ -33,7 +33,7 @@ enum class RetFormat {
};

static const struct {
enum RetFormat rf;
enum class RetFormat rf;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fails on clang with:

rest.cpp:36:10: error: reference to scoped enumeration must use 'enum' not 'enum class'
    enum class RetFormat rf;
         ^~~~~~
rest.cpp:71:13: error: reference to scoped enumeration must use 'enum' not 'enum class'
static enum class RetFormat ParseDataFormat(std::string& param, const std::string& strReq)
            ^~~~~~
2 errors generated.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

argh should have gone with my first version (just removing enum altogether!).

I'll update the PR soon.
Thanks!

@maflcko
Copy link
Member

maflcko commented May 6, 2018

@donaloconnor donaloconnor force-pushed the 06052018_unscoped_enum branch from 2f9430e to 021993f Compare May 6, 2018 21:42
@donaloconnor donaloconnor force-pushed the 06052018_unscoped_enum branch from 021993f to 66cc47b Compare May 6, 2018 21:49
@donaloconnor donaloconnor reopened this May 6, 2018
@donaloconnor
Copy link
Contributor Author

Okay - done finally (Got my branch into a messed up state which automatically closed the PR) :(

@sipa
Copy link
Member

sipa commented May 6, 2018

utACK 43f3dec

@practicalswift
Copy link
Contributor

utACK 43f3dec

Thanks for fixing this!

@promag
Copy link
Contributor

promag commented May 7, 2018

utACK 43f3dec.

Copy link
Contributor

@jonasschnelli jonasschnelli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK 43f3dec

@jonasschnelli jonasschnelli merged commit 43f3dec into bitcoin:master May 7, 2018
jonasschnelli added a commit that referenced this pull request May 7, 2018
…with some compilers)

43f3dec Remove enum specifier (to avoid re-declare scoped enum as unscoped) (donaloconnor)

Pull request description:

  MSVC fails to compile with the changes made in #10742

  The problem is enum types were changed to scoped (`enum class`) but in some places `enum` as an unscoped is used.

  This is a very simple fix and I've tested it.

  Edit: Had to remove enum altogether - `enum class` doesn't compile on clang.

Tree-SHA512: 13e21666243585a133c74c81249a1fa4098d6b7aa3cda06be871fa017c0ad9bb7b0725f801160b9d31678448d668718197941fd84702ebdef15128c27d92cd70
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jun 11, 2020
…issues with some compilers)

43f3dec Remove enum specifier (to avoid re-declare scoped enum as unscoped) (donaloconnor)

Pull request description:

  MSVC fails to compile with the changes made in bitcoin#10742

  The problem is enum types were changed to scoped (`enum class`) but in some places `enum` as an unscoped is used.

  This is a very simple fix and I've tested it.

  Edit: Had to remove enum altogether - `enum class` doesn't compile on clang.

Tree-SHA512: 13e21666243585a133c74c81249a1fa4098d6b7aa3cda06be871fa017c0ad9bb7b0725f801160b9d31678448d668718197941fd84702ebdef15128c27d92cd70
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jun 11, 2020
…issues with some compilers)

43f3dec Remove enum specifier (to avoid re-declare scoped enum as unscoped) (donaloconnor)

Pull request description:

  MSVC fails to compile with the changes made in bitcoin#10742

  The problem is enum types were changed to scoped (`enum class`) but in some places `enum` as an unscoped is used.

  This is a very simple fix and I've tested it.

  Edit: Had to remove enum altogether - `enum class` doesn't compile on clang.

Tree-SHA512: 13e21666243585a133c74c81249a1fa4098d6b7aa3cda06be871fa017c0ad9bb7b0725f801160b9d31678448d668718197941fd84702ebdef15128c27d92cd70
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jun 11, 2020
…issues with some compilers)

43f3dec Remove enum specifier (to avoid re-declare scoped enum as unscoped) (donaloconnor)

Pull request description:

  MSVC fails to compile with the changes made in bitcoin#10742

  The problem is enum types were changed to scoped (`enum class`) but in some places `enum` as an unscoped is used.

  This is a very simple fix and I've tested it.

  Edit: Had to remove enum altogether - `enum class` doesn't compile on clang.

Tree-SHA512: 13e21666243585a133c74c81249a1fa4098d6b7aa3cda06be871fa017c0ad9bb7b0725f801160b9d31678448d668718197941fd84702ebdef15128c27d92cd70
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jun 12, 2020
…issues with some compilers)

43f3dec Remove enum specifier (to avoid re-declare scoped enum as unscoped) (donaloconnor)

Pull request description:

  MSVC fails to compile with the changes made in bitcoin#10742

  The problem is enum types were changed to scoped (`enum class`) but in some places `enum` as an unscoped is used.

  This is a very simple fix and I've tested it.

  Edit: Had to remove enum altogether - `enum class` doesn't compile on clang.

Tree-SHA512: 13e21666243585a133c74c81249a1fa4098d6b7aa3cda06be871fa017c0ad9bb7b0725f801160b9d31678448d668718197941fd84702ebdef15128c27d92cd70
jasonbcox pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request Oct 16, 2020
…with some compilers)

Summary:
43f3dec Remove enum specifier (to avoid re-declare scoped enum as unscoped) (donaloconnor)

Pull request description:

  MSVC fails to compile with the changes made in #10742

  The problem is enum types were changed to scoped (`enum class`) but in some places `enum` as an unscoped is used.

  This is a very simple fix and I've tested it.

  Edit: Had to remove enum altogether - `enum class` doesn't compile on clang.

Backport of Core [[bitcoin/bitcoin#13180 | PR13180]]

Test Plan:
  ninja check

Reviewers: #bitcoin_abc, majcosta

Reviewed By: #bitcoin_abc, majcosta

Differential Revision: https://reviews.bitcoinabc.org/D7965
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Sep 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants