http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46239
Summary: Shouldn't this be a compile time error? Product: gcc Version: 4.4.3 Status: UNCONFIRMED Severity: minor Priority: P3 Component: c++ AssignedTo: unassig...@gcc.gnu.org ReportedBy: rahul.pa...@gmail.com 1 #include 2 long factorial(int arg=2); 3 int main() { 4 cout<<factorial(); 5 } 6 long factorial(int arg_number) { 7 return arg_number; 8 } Output: 2 Notice line 2 and 6 Different name is given to argument in declaration and definition. Also default value is provided in declaration (to a variable name which is not present in definition) and not in definition. Shouldn't this trigger some kind of compile error ? Output of gcc -v Using built-in specs. Target: i486-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Ubuntu 4.4.3-4ubuntu5' --with-bugurl=file:///usr/share/doc/gcc-4.4/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --enable-shared --enable-multiarch --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.4 --program-suffix=-4.4 --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-plugin --enable-objc-gc --enable-targets=all --disable-werror --with-arch-32=i486 --with-tune=generic --enable-checking=release --build=i486-linux-gnu --host=i486-linux-gnu --target=i486-linux-gnu Thread model: posix gcc version 4.4.3 (Ubuntu 4.4.3-4ubuntu5)