On Jun 4, 2012, at 5:36 AM, Dodji Seketeli wrote:
>>> -  s = s; // { dg-message "synthesized|deleted" }
>>> +  s = s;
>> 
>> Why do we lose this error?
> 
> Good question.
> 
> This is the result of a weird behaviour of DejaGNU, I think.

Yup, that is truly weird.  The problem is that the | operator is binding funny 
because there are no () around the substituted variables in the matching 
expressions in the .exp files, and the messages for a single line get the 
opportunity to match and eat multiple lines.

So, dejagnu is using:

        {[0-9]+: error:[^\n]*const|operator}

instead of:

        {[0-9]+: error:[^\n]*(const|operator)}

and that makes all the difference.

If you want, you can use just const, like so:

template <class T>
struct S {  // { dg-error "const" }
  S();
  T t;
};

The key is not to use |, or if you want to use |, you can (for now, until the 
underlying bug is fix) use:

template <class T>
struct S {  // { dg-error "(const|operator)" }
  S();
  T t;
}

to fix the underlying problem, we need something like:

Index: gcc-dg.exp
===================================================================
--- gcc-dg.exp  (revision 188120)
+++ gcc-dg.exp  (working copy)
@@ -744,6 +744,12 @@ if { [info procs saved-dg-error] == [lis
 proc process-message { msgproc msgprefix dgargs } {
     upvar dg-messages dg-messages
 
+    # We must enclose the expression in () to ensure any | in the
+    # pattern doesn't escape from this part of the expression.
+    set darg1 [lindex $dgargs 0]
+    set dgargs [lindex $dgargs 1]
+    set dgargs "$darg1 ($dgargs)"
+
     # Process the dg- directive, including adding the regular expression
     # to the new message entry in dg-messages.
     set msgcnt [llength ${dg-messages}]


which I'll test and see how bad off any other test cases are.  If people on 
fast machines want to weigh in, that'd be good.

Reply via email to