This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: default int paramters ignored?


yes, it is because you are using default template parameters wrong.
The fix is to add `<>' to Rnd.
The following code works:
template<int shift=1>
class Rnd {
  inline int Compute (int x) {
    return x >> shift;
  }
};

main() {
  Rnd<1> a; //<<== OK
  Rnd<> b;  //<<   OK too now adding <>
}

Thanks,
Andrew Pinski


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]