This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]