[Bug c++/23789] [3.4/4.0/4.1 Regression] compilation error when template parameters have certain complexity
andres_takach at mentor dot com
gcc-bugzilla@gcc.gnu.org
Fri Sep 9 02:37:00 GMT 2005
------- Additional Comments From andres_takach at mentor dot com 2005-09-09 02:37 -------
t.ii file:
# 1 "t.cxx"
# 1 "<built-in>"
# 1 "<command line>"
# 1 "t.cxx"
template<int W, bool S>
class mc_int {
public:
int d;
mc_int() { d = 0; }
mc_int(int x) { d = x; }
mc_int(const mc_int &x) { d = x.d; }
template<int W2, bool S2>
mc_int<((W+(S2&&!S)) > (W2+(S&&!S2)) ? (W+(S2&&!S)) : (W2+(S&&!S2)))+1,
(S||S2)> operator +(const mc_int<W2,S2> & x) const {
return 0;
}
};
typedef mc_int<6,false> ch_t;
template <int footemplate>
void foo_function(ch_t A, ch_t B, ch_t *C) {
A + B;
}
int main() {
ch_t fooA, fooB, fooC, fooD, fooE;
fooA= (ch_t) 5;
fooB= (ch_t) 15;
ch_t CC;
foo_function<0>(fooA, fooB, &CC);
}
---------------------------------------------------------------------
Output generated with "c++ -v -save-temps t.cxx":
Using built-in specs.
Target: i686-pc-linux-gnu
Configured with:
/user/jasong/hdl/sb/sim/dcs_gcc/ixl/build/src/gcc-4.0.1/configure
--prefix=/user/jasong/hdl/sb/sim/dcs_gcc/ixl/exports/mgc_home/pkgs/dcs_gcc.ixl/gcc-4.0.1
--enable-languages=c,c++
Thread model: posix
gcc version 4.0.1 (Mentor-DCS)
/user/jasong/hdl/sb/sim/dcs_gcc/ixl/exports/mgc_home/pkgs/dcs_gcc.ixl/gcc-4.0.1/libexec/gcc/i686-pc-linux-gnu/4.0.1/cc1plus -E -quiet -v -D_GNU_SOURCE t.cxx -mtune=pentiumpro -fpch-preprocess -o t.ii
ignoring nonexistent directory
"/user/jasong/hdl/sb/sim/dcs_gcc/ixl/exports/mgc_home/pkgs/dcs_gcc.ixl/gcc-4.0.1/lib/gcc/i686-pc-linux-gnu/4.0.1/../../../../i686-pc-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
/user/jasong/hdl/sb/sim/dcs_gcc/ixl/exports/mgc_home/pkgs/dcs_gcc.ixl/gcc-4.0.1/lib/gcc/i686-pc-linux-gnu/4.0.1/../../../../include/c++/4.0.1
/user/jasong/hdl/sb/sim/dcs_gcc/ixl/exports/mgc_home/pkgs/dcs_gcc.ixl/gcc-4.0.1/lib/gcc/i686-pc-linux-gnu/4.0.1/../../../../include/c++/4.0.1/i686-pc-linux-gnu
/user/jasong/hdl/sb/sim/dcs_gcc/ixl/exports/mgc_home/pkgs/dcs_gcc.ixl/gcc-4.0.1/lib/gcc/i686-pc-linux-gnu/4.0.1/../../../../include/c++/4.0.1/backward
/usr/local/include
/user/jasong/hdl/sb/sim/dcs_gcc/ixl/exports/mgc_home/pkgs/dcs_gcc.ixl/gcc-4.0.1/include
/user/jasong/hdl/sb/sim/dcs_gcc/ixl/exports/mgc_home/pkgs/dcs_gcc.ixl/gcc-4.0.1/lib/gcc/i686-pc-linux-gnu/4.0.1/include
/usr/include
End of search list.
/user/jasong/hdl/sb/sim/dcs_gcc/ixl/exports/mgc_home/pkgs/dcs_gcc.ixl/gcc-4.0.1/libexec/gcc/i686-pc-linux-gnu/4.0.1/cc1plus -fpreprocessed t.ii -quiet -dumpbase t.cxx -mtune=pentiumpro -auxbase t -version -o t.s
GNU C++ version 4.0.1 (Mentor-DCS) (i686-pc-linux-gnu)
compiled by GNU C version 3.4.3 (Mentor-DCS).
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
t.cxx: In function Âvoid foo_function(ch_t, ch_t, ch_t*)Â:
t.cxx:20: error: Â(((int)false) + 7)Â is not a valid template argument for type
Âint because it is a non-constant expression
t.cxx:20: error: no match for Âoperator+Â in ÂA + BÂ
--
What |Removed |Added
----------------------------------------------------------------------------
Known to work|3.3.3 |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23789
More information about the Gcc-bugs
mailing list