FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Fix to_string(std::any) overload by filipsajdak · Pull Request #203 · hsutter/cppfront · GitHub

Repository navigation

Fix to_string(std::any) overload - #203

Merged
hsutter merged 1 commit into
hsutter:mainfrom
filipsajdak:fsajdak-correct-to_string_std_any_overload
Jan 6, 2023
Merged

hsutter merged 1 commit into
hsutter:mainfrom
filipsajdak:fsajdak-correct-to_string_std_any_overload

Conversation

Copy link
Copy Markdown
Contributor

Closes #200

Having the code

struct X {};

main: () -> int = {
    x: X = ();

    std::cout << "x  = '(x)$'" << std::endl;
}

Currently, end with:

../tests/bug.cpp2... ok (mixed Cpp1/Cpp2, Cpp2 code passes safety checks)

x  = 'std::any'

But should with:

../tests/bug.cpp2... ok (mixed Cpp1/Cpp2, Cpp2 code passes safety checks)

x  = '(customize me - no cpp2::to_string overload exists for this type)'

This change replace the problematic `cpp2::to_string(std::any)z overload to:

template<typename T>
    requires std::is_same_v<T, std::any>
inline auto to_string(T const&) -> std::string {
  return "std::any";
}

And fix one regression test.

Comment thread include/cpp2util.h Outdated
filipsajdak force-pushed the fsajdak-correct-to_string_std_any_overload branch from e7c6a67 to 76dfe88 Compare January 6, 2023 17:00

hsutter commented Jan 6, 2023

Copy link
Copy Markdown
Owner

Thanks!

hsutter merged commit 7606052 into hsutter:main Jan 6, 2023
filipsajdak deleted the fsajdak-correct-to_string_std_any_overload branch January 6, 2023 18:47
Azmah-Bad pushed a commit to Azmah-Bad/cppfront that referenced this pull request Feb 24, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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

Successfully merging this pull request may close these issues.

[BUG] to_string(...) hidden by to_string(std::any) overload

3 participants


Back | FazBrowse Home | New Git URL