| Summary: | std::addressof vs. constexpr | ||
|---|---|---|---|
| Product: | gcc | Reporter: | Benjamin Kosnik <bkoz> |
| Component: | c++ | Assignee: | Not yet assigned to anyone <unassigned> |
| Status: | RESOLVED FIXED | ||
| Severity: | normal | CC: | daniel.kruegler, jason, webrown.cpp |
| Priority: | P3 | ||
| Version: | 4.8.0 | ||
| Target Milestone: | 7.0 | ||
| Host: | Target: | ||
| Build: | Known to work: | ||
| Known to fail: | Last reconfirmed: | 2016-06-29 00:00:00 | |
| Bug Depends on: | |||
| Bug Blocks: | 55004 | ||
|
Description
Benjamin Kosnik
2012-10-23 18:12:16 UTC
I agree, an intrinsic is needed Daniel, I'm confused: didn't we agree in that other open PR we have got about reinterpret_cast vs constexpr that actually the Standard should be amended exactly to allow this meaningful use of reint cast in the impl of address_of? (In reply to comment #2) During the Portland meeting the issue http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#1384 was discussed and core had consensus *not* to support reinterpret_cast in constant core expressions. I think this means we need to bite the bullet now. Ok, thanks, I wasn't there. Then please somebody add a note to that other PR. In any case, the other PR being about us actually accepting reint casts for the time being, I think it's Ok for our library to just constexpr for the time being and add a big comment about this PR, that is about the eventual need of an intrinsics as implementation detail. Since LWG decided not to allow implementations to add constexpr (sigh), I guess we don't need this intrinsic. (In reply to Jason Merrill from comment #5) Given that there exists the still open issue http://cplusplus.github.io/LWG/lwg-active.html#2296 should this bugzilla issue remain open? std::addressof can be constexpr with -std=gnu++XX, and even in strict mode std::__addressof can be constexpr for internal use in libstdc++. Although implementations can't add constexpr in general, LWG decided that they are required to add it to std::addressof: http://cplusplus.github.io/LWG/lwg-defects.html#2296 So confirming as a required feature. |