D
Dave
Hello,
Below, I have included a short program that does not compile. The
problematic line is indicated with a comment. Comeau produces this error:
"ComeauTest.c", line 19: error: type name is not allowed
T::bar_t<int> local;
^
Please note that the answer is *not* to preface the offending line with
"typename".
This is a problem with lookup of dependent names, and I think the
".template" construct is needed somehow. But I can't seem to get the right
syntax...
Thanks!
Dave
#include <iostream>
using namespace std;
struct foo_t
{
template <typename T>
struct bar_t
{
T m_var;
};
};
template <typename T>
struct geeker
{
void func()
{
T::bar_t<int> local; // Error here!
local.m_var = 42;
cout << local.m_var << endl;
}
};
int main()
{
geeker<foo_t> r;
r.func();
}
Below, I have included a short program that does not compile. The
problematic line is indicated with a comment. Comeau produces this error:
"ComeauTest.c", line 19: error: type name is not allowed
T::bar_t<int> local;
^
Please note that the answer is *not* to preface the offending line with
"typename".
This is a problem with lookup of dependent names, and I think the
".template" construct is needed somehow. But I can't seem to get the right
syntax...
Thanks!
Dave
#include <iostream>
using namespace std;
struct foo_t
{
template <typename T>
struct bar_t
{
T m_var;
};
};
template <typename T>
struct geeker
{
void func()
{
T::bar_t<int> local; // Error here!
local.m_var = 42;
cout << local.m_var << endl;
}
};
int main()
{
geeker<foo_t> r;
r.func();
}