Given the following short test program:

  const char *s1 = "\%\(\[\{"; // all these are invalid escape sequences
  const char *s2 = "\)\]\}";   // so are these

the compiler warns about the unknown escape sequences in s2 (and everything else
you can come up with), but ignores the particular sequences in s1, even though
they're just as invalid.

>From section 2.13.2, paragraph 3, of the 1998 C++ Standard:

Certain nongraphic characters, the single quote ', the double quote ", the
question mark ?, and the back-slash \, can be represented according to Table 5.
 ... If the character following a backslash is not one of those specified, the
behavior is undefined.

A warning for these four renegade unknown escapes, then, would be useful.

-- 
           Summary: Compiler does not warn on selected unknown character
                    escapes
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Severity: minor
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: simon_baldwin at yahoo dot com
                CC: gcc-bugs at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23688

Reply via email to