diff mbox series

[C++] Tweak concept diagnostics

Message ID 20191206202000.GI10088@tucnak
State New
Headers show
Series [C++] Tweak concept diagnostics | expand

Commit Message

Jakub Jelinek Dec. 6, 2019, 8:20 p.m. UTC
Hi!

I've noticed that while for requires keyword we have a diagnostics like
          error_at (cp_lexer_peek_token (parser->lexer)->location,
                    "%<requires%> only available with "
                    "%<-std=c++2a%> or %<-fconcepts%>");
for concept keyword we emit
	inform (location, "%<concept%> only available with %<-fconcepts%>");
The following patch adjusts the latter to match the former, because I think
more people will use -std=c++2a than -fconcepts in the GCC 10 timeframe.

Tested on x86_64-linux, ok for trunk?

2019-12-06  Jakub Jelinek  <jakub@redhat.com>

	* parser.c (cp_parser_diagnose_invalid_type_name): Mention
	that concept is also available with -std=c++2a.


	Jakub

Comments

Jason Merrill Dec. 6, 2019, 9:08 p.m. UTC | #1
On 12/6/19 3:20 PM, Jakub Jelinek wrote:
> Hi!
> 
> I've noticed that while for requires keyword we have a diagnostics like
>            error_at (cp_lexer_peek_token (parser->lexer)->location,
>                      "%<requires%> only available with "
>                      "%<-std=c++2a%> or %<-fconcepts%>");
> for concept keyword we emit
> 	inform (location, "%<concept%> only available with %<-fconcepts%>");
> The following patch adjusts the latter to match the former, because I think
> more people will use -std=c++2a than -fconcepts in the GCC 10 timeframe.
> 
> Tested on x86_64-linux, ok for trunk?

OK, thanks.

> 2019-12-06  Jakub Jelinek  <jakub@redhat.com>
> 
> 	* parser.c (cp_parser_diagnose_invalid_type_name): Mention
> 	that concept is also available with -std=c++2a.
> 
> --- gcc/cp/parser.c.jj	2019-12-05 10:03:04.072181899 +0100
> +++ gcc/cp/parser.c	2019-12-06 19:40:44.090311079 +0100
> @@ -3367,7 +3367,8 @@ cp_parser_diagnose_invalid_type_name (cp
>   	inform (location, "C++20 %<constinit%> only available with "
>   		"%<-std=c++2a%> or %<-std=gnu++2a%>");
>         else if (!flag_concepts && id == ridpointers[(int)RID_CONCEPT])
> -	inform (location, "%<concept%> only available with %<-fconcepts%>");
> +	inform (location, "%<concept%> only available with %<-std=c++2a%> or "
> +		"%<-fconcepts%>");
>         else if (processing_template_decl && current_class_type
>   	       && TYPE_BINFO (current_class_type))
>   	{
> 
> 	Jakub
>
diff mbox series

Patch

--- gcc/cp/parser.c.jj	2019-12-05 10:03:04.072181899 +0100
+++ gcc/cp/parser.c	2019-12-06 19:40:44.090311079 +0100
@@ -3367,7 +3367,8 @@  cp_parser_diagnose_invalid_type_name (cp
 	inform (location, "C++20 %<constinit%> only available with "
 		"%<-std=c++2a%> or %<-std=gnu++2a%>");
       else if (!flag_concepts && id == ridpointers[(int)RID_CONCEPT])
-	inform (location, "%<concept%> only available with %<-fconcepts%>");
+	inform (location, "%<concept%> only available with %<-std=c++2a%> or "
+		"%<-fconcepts%>");
       else if (processing_template_decl && current_class_type
 	       && TYPE_BINFO (current_class_type))
 	{