On 9/7/22 03:02, Simon Josefsson via Bug reports for GNU grep wrote:
$ grep '\Q' /dev/null
grep: warning: stray \ before Q
$ grep '[:alpha:]' /dev/null
grep: character class syntax is [[:space:]], not [:space:]
Is the use of diagnostic warnings like this supported by POSIX?
Yes, POSIX says that \Q produces undefined results, and that [:alpha:]
can be treated as either [[:alpha:]], [:alph], or an error (the last is
the GNU behavior).
I'd rather have tools exit with an error code on invalid
uses rather than issuing warning messages.
GNU grep does that for [:alpha:]. At some point it should do the same
for \Q, as \Q's behavior is squirrelly anyway. I thought it might be too
disruptive to do it for \Q right away so in 3.8 \Q merely gets warned about.