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

uuid cannot initialize from list on gcc with boost 1.86 #164

Open
johnwason opened this issue Aug 18, 2024 · 2 comments
Open

uuid cannot initialize from list on gcc with boost 1.86 #164

johnwason opened this issue Aug 18, 2024 · 2 comments

Comments

@johnwason
Copy link

I am seeing a weird error on gcc that I haven't seen before when compiling against boost 1.86:

/home/conda/feedstock_root/build_artifacts/robotraconteur_1723912067148/work/RobotRaconteurCore/src/HardwareTransport_linux.cpp:285:98: error: could not convert '{37, 187, 11, 98, 134, 26, 73, 116, 161, 184, 24, 237, 84, 149, 170, 7}' from '<brace-enclosed initializer list>' to 'boost::uuids::uuid'
  285 |                                                    0xa1, 0xb8, 0x18, 0xed, 0x54, 0x95, 0xaa, 0x07};
      |                                                                                                  ^
      |                                                                                                  |
      |                                                                                                  <brace-enclosed initializer list>

The offending code is this:

boost::uuids::uuid svc_uuid = {0x25, 0xbb, 0x0b, 0x62, 0x86, 0x1a, 0x49, 0x74,
                                                   0xa1, 0xb8, 0x18, 0xed, 0x54, 0x95, 0xaa, 0x07};

This has been working for years with boost version 1.58 through version 1.85.

@pdimov
Copy link
Member

pdimov commented Aug 18, 2024

The fix is

boost::uuids::uuid svc_uuid = {{0x25, 0xbb, 0x0b, 0x62, 0x86, 0x1a, 0x49, 0x74,
                                                   0xa1, 0xb8, 0x18, 0xed, 0x54, 0x95, 0xaa, 0x07}};

(use double braces.)

This has always been the "correct" way to initialize uuid, and the single braces version happened to work due to the brace elision rules because uuid was a simple struct. This is no longer the case after the 1.86 changes.

I tried hard to keep all existing valid uses working, but that's basically impossible once any nontrivial changes are made.

@johnwason
Copy link
Author

Interesting. I see the change now in the documentation between 1.85 and 1.86. Version 1.85 had single brackets.

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