[Bug c++/23789] [3.4/4.0/4.1 Regression] compilation error when template parameters have certain complexity

pinskia at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Fri Sep 9 02:39:00 GMT 2005


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-09-09 02:39 -------
Confirmed, reduced testcase:
#define MAX(a,b) ((a) > (b) ? (a) : (b))
template<int W, bool S>
class mc_int {
  template<int W2, bool S2>
  mc_int<MAX(W+(S2&&!S),W2+(S&&!S2))+1, false> operator +(const mc_int<W2,S2>& x) const;
};
typedef mc_int<6,false> ch_t;
template <int footemplate>
void foo_function(ch_t A, ch_t B, ch_t *C)
{
    A + B;
}

Note changing foo_function to a non template, makes this work.

This is caused by not folding in templates.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
  GCC build triplet|gcc version 4.0.1           |
   GCC host triplet|i686-pc-linux-gnu           |
 GCC target triplet|i686-pc-linux-gnu           |
      Known to work|                            |3.3.3
   Last reconfirmed|0000-00-00 00:00:00         |2005-09-09 02:39:23
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23789



More information about the Gcc-bugs mailing list