'float' is invalid template constant parameter error.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



All,
  Here is a bit of code, boiled down to it's essence, that works fine in both Visual C++ 6.0 sp 6 and Intel for Windows 8.1 but fails in GCC 3.2.3 and 3.4:

AdaNumeric_T.cpp
--------------

template <typename T, T delta_val>
class AdaNumeric_T
{
private:
  T t;
};

typedef AdaNumeric_T<int,1> AdaIntType;
typedef AdaNumeric_T<float,1.0> AdaFloatType;

int main(int argc, char* argv[])
{
  return 0;
}



(Please ignore the fact that I don't do anything with 'delta_val' and nothing is getting assigned to 'T t')

THE PROBLEM:

The typedef 'typedef AdaNumeric_T<int,1> AdaIntType;' works fine but the version right beneath it with the float type does not.  I get a:

"'float' is not a valid type for a template constant parameter"

Which seems strange.

Is the Intel compiler more ANSI compliant than GCC or is this a bug in GCC?  Does this work in GCC 4.0?

TIA

Bart Jenkins
ph: (703) 263-2883
General Dynamics
Advanced Information Systems
12450 Fair Lakes Circle
Fairfax, VA 22033




[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux