This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/11489] [3.4 Regression] ICE on typecast of template-argument-derived value as template argument
- From: "bangerth at dealii dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 12 Jul 2003 23:48:31 -0000
- Subject: [Bug c++/11489] [3.4 Regression] ICE on typecast of template-argument-derived value as template argument
- References: <20030710141450.11489.numerical.simulation@web.de>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11489
------- Additional Comments From bangerth at dealii dot org 2003-07-12 23:48 -------
Nathanael:
The code is ok, but you can only meaningfully instantiate the template with a
class that has a static const member named "value". Typically, you would
instantiate the template with classes that have "traits" character, for example
template <typename> struct is_integer { static const bool value = false; };
template <> struct is_integer<int> { static const bool value = true; };
template <typename T>
void f (T t) {
bar<is_integer<T> > b;
// do something with b
}
It's a very useful and powerful technique :-)
W.