Hello,

I do not have a login to submit a bug via bugzilla, so I use the
second method in http://gcc.gnu.org/bugs.html#where and attach all the
required info.

In short, compiling w/ g++-4.3
==================================================
template <class Comparable> Comparable max (Comparable x, Comparable y)
{
  return x >= y ? x : y;
}

template <int> int max (int x, int y); // OK
template <double> double max (double x, double y); // Fails

int main ()  { return 0;}
===================================================
results in "error: 'double' is not a valid type for a template
constant parameter", which I believe is inappropriate here.

  Is this a known bug? I found similar bugs:
http://gcc.gnu.org/ml/gcc-patches/2006-06/msg01159.html
http://gcc.gnu.org/ml/gcc-bugs/2007-12/msg02358.html, but they don't
quite match.

Another question: in http://gcc.gnu.org/bugs.html#known, there are
many references, e.g. "see [14.6]", but there is no
  bibliography. What is the refered document? (If it is an online
document, the page bugs.html could contain links, thus avoiding silly
questions like this one)

  Thanking you for making g++ available in the first place,

  Etienne
template <class Comparable> Comparable max (Comparable x, Comparable y)
{
  return x >= y ? x : y;
}

template <int> int max (int x, int y); // OK
template <double> double max (double x, double y); // Fails

int main ()
{
  return 0;
}

Attachment: try_template.ii
Description: Binary data

Attachment: try_template.s
Description: Binary data

Using built-in specs.
Target: i486-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 4.3.1-2' 
--with-bugurl=file:///usr/share/doc/gcc-4.3/README.Bugs 
--enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --enable-shared 
--with-system-zlib --libexecdir=/usr/lib --without-included-gettext 
--enable-threads=posix --enable-nls --with-gxx-include-dir=/usr/include/c++/4.3 
--program-suffix=-4.3 --enable-clocale=gnu --enable-libstdcxx-debug 
--enable-objc-gc --enable-mpfr --enable-targets=all --enable-cld 
--enable-checking=release --build=i486-linux-gnu --host=i486-linux-gnu 
--target=i486-linux-gnu
Thread model: posix
gcc version 4.3.1 (Debian 4.3.1-2) 
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-Wall' '-o' 'try_template' 
'-shared-libgcc' '-mtune=generic'
 /usr/lib/gcc/i486-linux-gnu/4.3.1/cc1plus -E -quiet -v -D_GNU_SOURCE 
try_template.cpp -mtune=generic -Wall -fpch-preprocess -o try_template.ii
ignoring nonexistent directory "/usr/local/include/i486-linux-gnu"
ignoring nonexistent directory 
"/usr/lib/gcc/i486-linux-gnu/4.3.1/../../../../i486-linux-gnu/include"
ignoring nonexistent directory "/usr/include/i486-linux-gnu"
#include "..." search starts here:
#include <...> search starts here:
 /usr/include/c++/4.3
 /usr/include/c++/4.3/i486-linux-gnu
 /usr/include/c++/4.3/backward
 /usr/local/include
 /usr/lib/gcc/i486-linux-gnu/4.3.1/include
 /usr/lib/gcc/i486-linux-gnu/4.3.1/include-fixed
 /usr/include
End of search list.
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-Wall' '-o' 'try_template' 
'-shared-libgcc' '-mtune=generic'
 /usr/lib/gcc/i486-linux-gnu/4.3.1/cc1plus -fpreprocessed try_template.ii 
-quiet -dumpbase try_template.cpp -mtune=generic -auxbase try_template -Wall 
-version -o try_template.s
GNU C++ (Debian 4.3.1-2) version 4.3.1 (i486-linux-gnu)
        compiled by GNU C version 4.3.1, GMP version 4.2.2, MPFR version 2.3.1.
GGC heuristics: --param ggc-min-expand=62 --param ggc-min-heapsize=60358
Compiler executable checksum: 61e5e0ff4ba061bbc735c00efd721073
try_template.cpp:8: error: 'double' is not a valid type for a template constant 
parameter

Reply via email to