Thread overview | |||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
December 05, 2002 Another namespace bug | ||||
---|---|---|---|---|
| ||||
Here is another one:
namespace A
{
struct C
{
C(int i)
{ }
};
namespace B
{
template<class T>
struct D
{
D()
{
C c(3);
// Error: undefined identifier 'C'
}
};
}
}
int main()
{
A::B::D<int> d;
return 0;
}
bye, Christof
--
http://cmeerw.org JID: cmeerw@jabber.at mailto cmeerw at web.de
|
December 05, 2002 Re: Another namespace bug | ||||
---|---|---|---|---|
| ||||
Posted in reply to Christof Meerwald | In article <asnd0i$2jn0$1@digitaldaemon.com>, Christof Meerwald says... > >Here is another one: also, typedef int Int; namespace std { using ::Int; } namespace one { struct A { std::Int* test; }; void main() { } gets Int is not a member of namespace std at "std::Int* test" Richard |
December 05, 2002 Re: Another namespace bug | ||||
---|---|---|---|---|
| ||||
Posted in reply to Christof Meerwald | Another one:
namespace ns
{
struct A {};
template <class T>
struct B { };
template<>
struct B<A>
{
typedef A iterator_category;
// Error: ';' expected following declaration of struct member
};
}
int main()
{
ns::B<ns::A> i;
return 0;
}
bye, Christof
--
http://cmeerw.org JID: cmeerw@jabber.at mailto cmeerw at web.de
...and what have you contributed to the Net?
|
December 06, 2002 Re: Another namespace bug | ||||
---|---|---|---|---|
| ||||
Posted in reply to Christof Meerwald | And another one:
namespace ns
{
template<class T>
struct A
{
static void f()
{ }
};
template<class T>
struct B
{
void f()
{
A<T>::f();
// Error: 'ns::A<>::f' previously declared as something else
// It was declared as: void C func()
// It is now declared: int C func()
}
};
}
int main()
{
ns::B<int> b;
b.f();
return 0;
}
bye, Christof
--
http://cmeerw.org JID: cmeerw@jabber.at mailto cmeerw at web.de
...and what have you contributed to the Net?
|
December 06, 2002 Re: Another namespace bug | ||||
---|---|---|---|---|
| ||||
Posted in reply to Christof Meerwald | Another one:
namespace ns
{
template<class T>
struct A
{
void f();
};
template<class T>
void A<T>::f()
// Error: 'A' is not a class template
{ }
}
int main()
{
ns::A<int> a;
a.f();
return 0;
}
bye, Christof
--
http://cmeerw.org JID: cmeerw@jabber.at mailto cmeerw at web.de
...and what have you contributed to the Net?
|
December 07, 2002 Re: Another namespace bug | ||||
---|---|---|---|---|
| ||||
Posted in reply to Christof Meerwald | Another one:
namespace ns
{
struct A
{
A()
{ }
};
struct B
: public ns::A
{
B()
: ns::A()
// Error: 'ns' is not a member of struct 'ns::B'
{ }
};
}
int main()
{
return 0;
}
bye, Christof
--
http://cmeerw.org JID: cmeerw@jabber.at mailto cmeerw at web.de
...and what have you contributed to the Net?
|
December 07, 2002 Re: Another namespace bug | ||||
---|---|---|---|---|
| ||||
Posted in reply to Christof Meerwald | template<class T>
struct A
{ };
namespace ns
{
template<class T>
struct A
// Error: 'A' is already defined
{ };
}
int main()
{
A<int> a;
ns::A<int> ns_a;
return 0;
}
bye, Christof
--
http://cmeerw.org JID: cmeerw@jabber.at mailto cmeerw at web.de
...and what have you contributed to the Net?
|
December 07, 2002 Re: Another namespace bug | ||||
---|---|---|---|---|
| ||||
Posted in reply to Christof Meerwald | template<class T>
struct A
{ };
namespace ns
{
using ::A;
}
int main()
{
ns::A<int> a;
// Error: '<' expected following 'A'
return 0;
}
bye, Christof
--
http://cmeerw.org JID: cmeerw@jabber.at mailto cmeerw at web.de
...and what have you contributed to the Net?
|
December 08, 2002 Re: Another namespace bug | ||||
---|---|---|---|---|
| ||||
Posted in reply to Christof Meerwald | namespace ns1
{
template<class T>
struct A
{
A() { }
// Error: namespace 'ns2' does not enclose member '?0' of namespace 'ns1'
};
}
namespace ns2
{
void f()
{
ns1::A<int> a;
}
}
int main()
{
ns2::f();
return 0;
}
bye, Christof
--
http://cmeerw.org JID: cmeerw@jabber.at mailto cmeerw at web.de
...and what have you contributed to the Net?
|
December 09, 2002 Re: Another namespace bug | ||||
---|---|---|---|---|
| ||||
Posted in reply to Christof Meerwald | namespace ns
{
template<class T>
struct A
{ };
}
using ns::A;
struct B
: public A<int>
// Error: 'A' is not a struct or a class
{ };
int main()
{
B b;
return 0;
}
bye, Christof
--
http://cmeerw.org JID: cmeerw@jabber.at mailto cmeerw at web.de
...and what have you contributed to the Net?
|
Copyright © 1999-2021 by the D Language Foundation