On 10/14/2017 01:51 PM, Enrico Forestieri wrote: > On Sat, Oct 14, 2017 at 07:30:29PM +0200, Jürgen Spitzmüller wrote: >> Am Samstag, den 14.10.2017, 19:15 +0200 schrieb Enrico Forestieri: >>> On Sat, Oct 14, 2017 at 06:51:31PM +0200, Jürgen Spitzmüller wrote: >>>> What happens if you do >>>> >>>> LYXERR0("test 1: " << sub.str(5)); >>>> string const test = sub.str(5); >>>> LYXERR0("test 2: " << test); >>> The result is: >>> >>> BiblioInfo.cpp (252): test 1: %surname% >>> BiblioInfo.cpp (254): test 2: %surname% >>> >>> but later I get again "%prename% %surnamP". However, the attached >>> patch >>> seems to fix this issue, even if it is a mystery why it does. >>> This must be a compiler bug. >> Mysterious indeed. However, if it really fixes the bug, commit it (with >> a comment explaining why we use this temporary string here). After all, >> this change cannot harm. >> >> (But of course it would be better if we knew what is going on here). > Note that this seems to be very fragile. For example, moving the > line defining the match5 variable down, it does not work anymore. > It is as if the various matches must be accessed in reverse order, > otherwise the last one gets corrupted. > > There are three instances where this is done, so a more exhaustive > patch would be the attached one, which still fixes the issue for me. > > This is with gcc 6.4.0. Maybe other versions don't have the issue.
Very, very weird. As you said, must be a compiler bug. Nice work to find a workaround. I'll give +1 to commit it. Can't possibly do any harm, as Jürgen said first.... Richard