Topic: Passing the address of a non-type template parameter


Author: stefaandr@hotmail.com (Stefaan De Roeck)
Date: Mon, 8 Sep 2003 08:28:42 +0000 (UTC)
Raw View
Hi!

Until recently, I've been happily using code like:
template <int * a> class class2 {};
template <int & a> class class1 : public class2 <&a> {};

This compiled on gcc 3.0 through 3.3.x, but the cvs version doesn't
seem to approve of my code anymore.  After digging through the
standard, it seems that it makes a difference between passing the
address of an object with external linkage, and passing the address
of a template parameter referring to something with external linkage.
This was concluded in the bug-record:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11993

This somehow contradicts my general sense of c++-logic, and I
don't mean to say I truly understand the inner workings of the
language syntax itself, but this core-gcc-developer Mark Mitchell
suggested that I mention it here, because this may be seen as
a c++-standard-defect.  (If it is, this could mean I don't have
to rewrite my code ;)

Any thoughts on this are welcome,
Regards,
Stefaan

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html                       ]