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

🚨 [diagnosis] Force string literal to display in GCC #55

Merged
merged 1 commit into from
Jul 6, 2024

Conversation

patrickroberts
Copy link
Contributor

Before this change, only Clang displayed the diagnosis string literal while GCC did not expand the string literal in the compiler error.

GCC 15.0.0

Before:

[build] /home/patrick/projects/reflect/reflect:478:9:   required for the satisfaction of ‘diagnosis<diagnose_member_name<T, Name>()>’ [with T = ._anon_95::operator()::foo; Name = reflect::v1_1_1::fixed_string<char, 3>{"baz"}]
[build] /home/patrick/projects/reflect/reflect:481:9:   required for the satisfaction of ‘member_name_diagnosis<typename std::remove_cvref<_Tp>::type, Name>’ [with T = ._anon_95::operator()::foo; Name = reflect::v1_1_1::fixed_string<char, 3>{"baz"}]
[build] /home/patrick/projects/reflect/reflect:478:29: note: the expression ‘Message == std::string_view({}) [with Message = diagnose_member_name()()]’ evaluated to ‘false’
[build]   478 | concept diagnosis = Message == std::string_view{};
[build]       |                     ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~

After:

[build] /home/patrick/projects/reflect/reflect:481:9:   required for the satisfaction of ‘diagnosis<reflect::v1_1_1::detail::print<diagnose_member_name<T, Name>()> >’ [with T = ._anon_95::operator()::foo; Name = reflect::v1_1_1::fixed_string<char, 3>{"baz"}]
[build] /home/patrick/projects/reflect/reflect:484:9:   required for the satisfaction of ‘member_name_diagnosis<typename std::remove_cvref<_Tp>::type, Name>’ [with T = ._anon_95::operator()::foo; Name = reflect::v1_1_1::fixed_string<char, 3>{"baz"}]
[build] /home/patrick/projects/reflect/reflect:481:31: note: the expression ‘TMessage::value [with TMessage = reflect::v1_1_1::detail::print<reflect::v1_1_1::fixed_string<char, 57>{"`foo` has no data member named `baz`. Did you mean `bar`?"}>]’ evaluated to ‘false’
[build]   481 | concept diagnosis = TMessage::value;
[build]       |                               ^~~~~

Clang 18.1.8

Before:

[build] /home/patrick/projects/reflect/reflect:481:33: note: because diagnose_member_name<foo, fixed_string<char, 3UL>{"baz"}>() does not satisfy 'diagnosis'
[build]   481 | concept member_name_diagnosis = diagnosis<diagnose_member_name<T, Name>()>;
[build]       |                                 ^
[build] /home/patrick/projects/reflect/reflect:478:21: note: because 'fixed_string<char, 57UL>{"`foo` has no data member named `baz`. Did you mean `bar`?"} == std::string_view{}' evaluated to false
[build]   478 | concept diagnosis = Message == std::string_view{};
[build]       |                     ^

After:

[build] /home/patrick/projects/reflect/reflect:484:33: note: because 'print<diagnose_member_name<foo, fixed_string<char, 3UL>{"baz"}>()>' does not satisfy 'diagnosis'
[build]   484 | concept member_name_diagnosis = diagnosis<print<diagnose_member_name<T, Name>()>>;
[build]       |                                 ^
[build] /home/patrick/projects/reflect/reflect:481:21: note: because 'print<fixed_string<char, 57UL>{"`foo` has no data member named `baz`. Did you mean `bar`?"}>::value' evaluated to false
[build]   481 | concept diagnosis = TMessage::value;
[build]       |                     ^

@kris-jusiak kris-jusiak merged commit 5a724b3 into qlibs:main Jul 6, 2024
@patrickroberts patrickroberts deleted the gcc_diagnosis branch July 6, 2024 06:18
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.

2 participants