www.digitalmars.com         C & C++   DMDScript  

c++.beta - Is this an error

// try this piece of source codes
#include <iostream.h>

template <const char *& STR>
struct TEST {
TEST() {
cout << *STR << endl;
// is this weird
}
};

const char *g = "Hello World";

int main()
{
TEST<g> obj;

return 0;
}

// The running results are (of course)
Hello World
// but if I use STR instead of *STR in the TEST template, I got some address.
The compiler I used is the 8.34 beta5
Apr 18 2003