diff --git a/c.c b/c.c index 40db0e5..386af29 100644 --- a/c.c +++ b/c.c @@ -1392,20 +1392,38 @@ static void skipToMatch (const char *const pair) if (c == begin) { - ++matchLevel; - if (braceFormatting && getDirectiveNestLevel () != initialLevel) - { - skipToFormattedBraceMatch (); - break; + // watch out for '<<' in template arguments + int x = cppGetc (); + if(c == '<' && x == '<') { + // we've found a << - do nothing except record the signature + if (CollectingSignature) + vStringPut(Signature, x); + } else { + cppUngetc (x); + ++matchLevel; + if (braceFormatting && getDirectiveNestLevel () != initialLevel) + { + skipToFormattedBraceMatch (); + break; + } } } else if (c == end) { - --matchLevel; - if (braceFormatting && getDirectiveNestLevel () != initialLevel) - { - skipToFormattedBraceMatch (); - break; + // watch out for '>>' in template arguments + int x = cppGetc (); + if(c == '>' && x == '>') { + // we've found a >> - do nothing except record the signature + if (CollectingSignature) + vStringPut(Signature, x); + } else { + cppUngetc (x); + --matchLevel; + if (braceFormatting && getDirectiveNestLevel () != initialLevel) + { + skipToFormattedBraceMatch (); + break; + } } } }