[Bug c++/11191] New: Applying format attribute to member functions is off by one

schepler@math.berkeley.edu gcc-bugzilla@gcc.gnu.org
Sat Jun 14 08:18:00 GMT 2003


PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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

           Summary: Applying format attribute to member functions is off by
                    one
           Product: gcc
           Version: 3.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: schepler@math.berkeley.edu
                CC: gcc-bugs@gcc.gnu.org

The following source fails to build: 
 
class Scanner { 
public: 
  void scanLine(const char *fmt, ...) __attribute__((format(scanf,1,2))); 
}; 
 
int foo() { 
  Scanner s; 
  int a, b, c; 
  s.scanLine("foo %d %d %d", &a, &b, &c); 
} 
 
with the error message: 
 
format.cc:3: error: format string arg not a string type 
 
Changing the argument numbers to 2 and 3 allows the file to compile, and 
the format checking works properly with this change.



More information about the Gcc-bugs mailing list