Bug 26206 - g++ allows params with default arguments to the left of those without
Summary: g++ allows params with default arguments to the left of those without
Status: RESOLVED DUPLICATE of bug 16829
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.0.2
: P3 normal
Target Milestone: 4.0.3
Assignee: Not yet assigned to anyone
URL:
Keywords: accepts-invalid
Depends on:
Blocks:
 
Reported: 2006-02-10 02:18 UTC by jjamison
Modified: 2006-02-10 02:24 UTC (History)
6 users (show)

See Also:
Host: i686-pc-linux-gnu
Target: i686-pc-linux-gnu
Build: i686-pc-linux-gnu
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description jjamison 2006-02-10 02:18:39 UTC
Compiling the following one line:

   void f(int i = 0, int j) {}

produces the following error, as appropriate:

[jjamison@manzanita]$ /usr/misc/pkg/gcc-4.0.2/bin/g++ -c default.cc
default.cc: In function `void f(int, int)':
default.cc:1: error: default argument missing for parameter 2 of `void f(int, int)'
[jjamison@manzanita]$

However, compiling the following analogous code produces no errors, even though it should:

   struct T {
      T(int i = 0, int j) {}
      void m(int i = 0, int j) {}
   };

[jjamison@manzanita]$ /usr/misc/pkg/gcc-4.0.2/bin/g++ -c default.cc
[jjamison@manzanita]$

This behavior is replicated in 4.0.1, 4.0.0, 3.4.4, and 3.4.3.

[jjamison@manzanita]$ /usr/misc/pkg/gcc-4.0.2/bin/g++ -v
Using built-in specs.
Target: i686-pc-linux-gnu
Configured with: ../gcc-4.0.2/configure --prefix=/usr/misc/pkg/gcc-4.0.2 --enable-shared --enable-threads=posix --with-system-zlib --with-gnu-as --with-as=/usr/misc/pkg/binutils-2.16/bin/as --with-gnu-ld --with-ld=/usr/misc/pkg/binutils-2.16/bin/ld --enable-__cxa_atexit --enable-languages=c,c++
Thread model: posix
gcc version 4.0.2
Comment 1 Andrew Pinski 2006-02-10 02:24:40 UTC
This is a dup  of bug 16829 which was fixed in 4.0.3.

*** This bug has been marked as a duplicate of 16829 ***