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

[BUG] cpp2util.h uses std::same_as but does not include <concepts> #454

Closed
cpp-niel opened this issue May 13, 2023 · 1 comment
Closed
Labels
bug Something isn't working

Comments

@cpp-niel
Copy link

Describe the bug
std::same_as from the <concepts> header is used to constrain one of the to_string overloads in cpp2util.h (https://github.com/hsutter/cppfront/blob/38aec572f34997699454efdb13cf4e4e409c2cc7/include/cpp2util.h#LL1411C61-L1411C61). However the <concepts> header is not explicitly included in cpp2util.h.

This can cause the cppfront compiler to fail to build - for example when using AppleClang 13.0.0.

To Reproduce
Build the cppfront compiler on macOS using AppleClang 13.0.0. The build fails with the following output:

/Users/User/Documents/dev/cpp/cppfront/./source/../include/cpp2util.h:1412:13: error: redefinition of 'to_string' as different kind of symbol
inline auto to_string(std::same_as<std::any> auto const&) -> std::string {
            ^
/Users/User/Documents/dev/cpp/cppfront/./source/../include/cpp2util.h:1408:13: note: previous definition is here
inline auto to_string(...) -> std::string {
            ^
/Users/User/Documents/dev/cpp/cppfront/./source/../include/cpp2util.h:1412:28: error: no member named 'same_as' in namespace 'std'
inline auto to_string(std::same_as<std::any> auto const&) -> std::string {
                      ~~~~~^

After including the <concepts> header the build succeeds.

@cpp-niel cpp-niel added the bug Something isn't working label May 13, 2023
@hsutter
Copy link
Owner

hsutter commented May 15, 2023

Fixed, thanks!

zaucy pushed a commit to zaucy/cppfront that referenced this issue Dec 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants