Message ID | 20191206202000.GI10088@tucnak |
---|---|
State | New |
Headers | show |
Series | [C++] Tweak concept diagnostics | expand |
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 >
--- 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)) {