This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/11191] New: Applying format attribute to member functions is off by one
- From: "schepler at math dot berkeley dot edu" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 14 Jun 2003 08:18:47 -0000
- Subject: [Bug c++/11191] New: Applying format attribute to member functions is off by one
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
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.