Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@alex-700
Copy link
Contributor

  • it is workaround CWG 903 in gcc-12, which is considering int{} as null pointer constant, and so can't choose between safe_assert_msg_types_one(uint64_t) and safe_assert_msg_types_one(char const *)
  • see https://godbolt.org/z/fov5xPjEe

closes #1772

- it is workaround CWG 903 in gcc-12, which is considering `int{}`  as null pointer constant, and so can't choose between `safe_assert_msg_types_one(uint64_t)` and `safe_assert_msg_types_one(char const *)`
- see https://godbolt.org/z/fov5xPjEe
@facebook-github-bot
Copy link
Contributor

Hi @alex-700!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at [email protected]. Thanks!

@facebook-github-bot
Copy link
Contributor

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

@facebook-github-bot
Copy link
Contributor

@Orvid has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.


template <typename... A>
safe_assert_msg_type_s<decltype(safe_assert_msg_types_one(A{}))::value...>
safe_assert_msg_type_s<decltype(safe_assert_msg_types_one(std::declval<A>()))::value...>
Copy link
Contributor

Choose a reason for hiding this comment

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

It looks like a shorter syntax is available.

Suggested change
safe_assert_msg_type_s<decltype(safe_assert_msg_types_one(std::declval<A>()))::value...>
safe_assert_msg_type_s<decltype(safe_assert_msg_types_one((A)A{}))::value...>

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@yfeldblum thanks for the idea!
But I prefer to use std::declval here, because it explicitly claims that this is unevaluated context.

Copy link
Contributor

Choose a reason for hiding this comment

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

I assumed declval might be slower to compile, but I am not seeing that assumption holding in my tests.

Copy link
Contributor

Choose a reason for hiding this comment

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

The use of declval triggered some bug or pathological behavior somewhere. I don't know what the problem is, but that's why this was reverted.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@yfeldblum should I do something with it?

Copy link
Contributor

Choose a reason for hiding this comment

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

I have merged this again but with (A). Hopefully that will not trigger the same bug.

@facebook-github-bot
Copy link
Contributor

This pull request has been reverted by 7e5eefc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

compile error on gcc12

3 participants