This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [C++, diagnostic] PR 33495


Hi Gaby,
> Paolo Carlini <pcarlini@suse.de> writes:
>
> | Hi all, hi Gaby,
> | 
> | I'm trying to make progress on this PR, taking also into account Jakub'
> | comment in the audit trail about the unbounded size of statements.
> | Currently I have the below, which passes regtesting on x86_64-linux,
> | makes sense to you?
>
> If we had `diagnostics with carret', we would just point to the locus
> of the error.  Currently, we don't.  Just printing the statement would
> not be good either -- because the internal representation does not
> always accurately reflect the source code.
I see...
>   So, yes you're is OK if
> you changed
>
> | +       pp_cxx_identifier (cxx_pp, "<expression>");
>
>
> to
>
>  +       pp_cxx_identifier (cxx_pp, "<statement>");
>   
The below is what I actually committed.

Thanks,
Paolo.

/////////////////
2007-11-02  Paolo Carlini  <pcarlini@suse.de>

	PR c++/33495
	* error.c (dump_expr): Deal specially with statements.

2007-11-02  Paolo Carlini  <pcarlini@suse.de>

	PR c++/33495
	* g++.dg/other/error19.C: New.
Index: testsuite/g++.dg/other/error19.C
===================================================================
*** testsuite/g++.dg/other/error19.C	(revision 0)
--- testsuite/g++.dg/other/error19.C	(revision 0)
***************
*** 0 ****
--- 1,7 ----
+ // PR c++/33495
+ 
+ void foo()
+ {
+   if (({while(true);})) // { dg-error "forbids|<statement>" }
+     ;
+ }
Index: cp/error.c
===================================================================
*** cp/error.c	(revision 129845)
--- cp/error.c	(working copy)
*************** dump_expr (tree t, int flags)
*** 1437,1442 ****
--- 1437,1448 ----
    if (t == 0)
      return;
  
+   if (STATEMENT_CLASS_P (t))
+     {
+       pp_cxx_identifier (cxx_pp, "<statement>");
+       return;
+     }
+ 
    switch (TREE_CODE (t))
      {
      case VAR_DECL:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]