Skip to content

clang std::source_location::current() fail #60912

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

Closed
PaltryProgrammer opened this issue Feb 22, 2023 · 13 comments
Closed

clang std::source_location::current() fail #60912

PaltryProgrammer opened this issue Feb 22, 2023 · 13 comments
Labels
c++20 consteval C++20 consteval duplicate Resolved as duplicate

Comments

@PaltryProgrammer
Copy link

greetings kind regards clang std::current_location::current() results in error as shown MSVC compiles w/o error kindly advise Thank You Kindly
source_location-current fail

@EugeneZelenko
Copy link
Contributor

Could you please create reproducer on https://godbolt.org ?

@PaltryProgrammer
Copy link
Author

i do not know what a "reproducer" is . however w/ clang 15.0.0 as i did not see a 17.0.0 it seems to work as you can see
clang source_location-current success on godbolt

@fsb4000
Copy link
Member

fsb4000 commented Feb 22, 2023

It's expected.

Microsoft STL requires __cpp_consteval to be defined for working source_location https://github.com/microsoft/STL/blob/e7f52446c6f41fddbed31904f594a1f711f85601/stl/inc/source_location#L11

And clang 15 doesn't fully implement cpp_consteval so it doesn't define that macro.

https://godbolt.org/z/soxeEaxnT

Even clang trunk doesn't define that macro: https://godbolt.org/z/K7rMfdW9E

@fsb4000 fsb4000 closed this as completed Feb 22, 2023
@fsb4000
Copy link
Member

fsb4000 commented Feb 22, 2023

Actually it looks like compiler devs just forgot to define that macro: #57094

but maybe some bugs still exist and compiler devs don't want to define the macro.

@fsb4000 fsb4000 added duplicate Resolved as duplicate c++20 consteval C++20 consteval and removed new issue labels Feb 22, 2023
@llvmbot
Copy link
Member

llvmbot commented Feb 22, 2023

@llvm/issue-subscribers-c-20

@PaltryProgrammer
Copy link
Author

if __cpp_consteval is required but not provided why was the compile shown here successful ?

@fsb4000
Copy link
Member

fsb4000 commented Feb 22, 2023

if __cpp_consteval is required but not provided why was the compile shown here successful ?

Microsoft STL implementation checks that macro but libc++ and libstdc++ don't check.

(Your example uses libstdc++ , if you add -stdlib=libc++ then your example will use libc++ and as far as I know the compiler explorer can't use Microsoft STL together with clang)

@fsb4000
Copy link
Member

fsb4000 commented Feb 22, 2023

if __cpp_consteval is required

std::current_location::current() needs __cpp_consteval 100%.

Look: https://en.cppreference.com/w/cpp/utility/source_location/current

It's consteval

изображение

@fsb4000
Copy link
Member

fsb4000 commented Feb 22, 2023

Hi @AaronBallman !

Could you give us an update about the __cpp_consteval macro?

@PaltryProgrammer
Copy link
Author

i merely added the macro and it seems to have worked
success by adding macro

@AaronBallman
Copy link
Collaborator

Hi @AaronBallman !

Could you give us an update about the __cpp_consteval macro?

I know we're at least missing support for https://wg21.link/P2564R3 in terms of setting the value to 202211L, but we might be at the point to define it to 201811L. I know we're certainly close these days, but a quick look through the bug database shows ~40 open issues related to consteval (not all of these are going to be issues holding us back from claiming conformance though).

One thing that would help is if someone was able to run an experiment defining the macro to the 2018 value and trying to compile a bunch of large C++ relatively modern projects to see if that points out bugs we're not aware of.

@fsb4000
Copy link
Member

fsb4000 commented Feb 22, 2023

Well, I have pretty slow PC (AMD FX8300) but I could run some projects too.

Do you have a list of such projects?

Also, look what I've found: chromium/subspace@e18b443#diff-eb105f54978bac9a1111fa159977cd7cf6d3372ce522c53019c294c4d5142f8eR95

and marzer/muu@25ff4e5#diff-9fee50b957f0636d37f5d5ed34361016c89b77729fdd415316d06598e1530ed1R412-R418

@EugeneZelenko EugeneZelenko closed this as not planned Won't fix, can't repro, duplicate, stale Feb 22, 2023
@AaronBallman
Copy link
Collaborator

Do you have a list of such projects?

Chromium was one such project, but you found something out there! :-D The other projects I usually use for this sort of thing (uncertain of how much consteval use they have, though) are Qt, kokkos, boost, and Folly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c++20 consteval C++20 consteval duplicate Resolved as duplicate
Projects
Status: No status
Development

No branches or pull requests

5 participants