c++ - Another namespace bug
- Christof Meerwald (30/30) Dec 05 2002 Here is another one:
- Richard (11/12) Dec 05 2002 also,
- Christof Meerwald (23/23) Dec 05 2002 Another one:
- Christof Meerwald (32/32) Dec 06 2002 And another one:
- Christof Meerwald (24/24) Dec 06 2002 Another one:
- Christof Meerwald (26/26) Dec 06 2002 Another one:
-
Christof Meerwald
(21/21)
Dec 07 2002
template
-
Christof Meerwald
(18/18)
Dec 07 2002
template
- Christof Meerwald (26/26) Dec 08 2002 namespace ns1
- Richard (4/11) Dec 09 2002 This is a really nasty one that tends to cause protection fault when com...
- Richard (6/13) Dec 09 2002 Ok, after a retest, the code provided in Christof's test case causes a
- Christof Meerwald (21/21) Dec 09 2002 namespace ns
- Christof Meerwald (29/29) Dec 09 2002 namespace ns1
- Christof Meerwald (22/22) Dec 11 2002 namespace ns
- Christof Meerwald (26/26) Dec 11 2002 namespace ns
-
Christof Meerwald
(23/23)
Dec 14 2002
#include
-
Walter
(3/26)
Dec 14 2002
Ah, no rest for the wicked
. - Richard (22/22) Dec 15 2002 Not sure if Christof posted this yet..
- Walter (7/30) Dec 17 2002 I believe DMC++ is behaving correctly here. f(int i) is not declared in ...
- Christof Meerwald (10/41) Dec 17 2002 But the next sentence in the standard is: "The name of the friend is not
- Walter (6/16) Dec 17 2002 a
- Richard (17/17) Dec 19 2002 Not sure about the analysis of this, but it works fine if I remove names...
- Christof Meerwald (11/29) Dec 22 2002 Hmm, just found an example in the C++ standard, see 14.6.5 Friend names
- Walter (6/9) Dec 22 2002 omniORB,
- Matthew Wilson (6/15) Dec 22 2002 I presume that goes for all of us, yes?
- Walter (3/22) Dec 22 2002 Of course!
- Robert M. Münch (3/4) Dec 23 2002 Walter, how do you keep track of bugs and do you use a tool for this? Ro...
- Walter (4/8) Dec 23 2002 Robert
- Christof Meerwald (23/23) Dec 16 2002 namespace ns
- Christof Meerwald (31/31) Dec 21 2002 namespace ns
- Christof Meerwald (24/24) Dec 21 2002 namespace ns
- Christof Meerwald (21/21) Jan 01 2003 void f();
- Christof Meerwald (17/17) Jan 01 2003 Quite similar to the previous one:
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
Dec 05 2002
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
Dec 05 2002
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?
Dec 05 2002
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?
Dec 06 2002
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?
Dec 06 2002
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?
Dec 06 2002
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?
Dec 07 2002
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?
Dec 07 2002
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?
Dec 08 2002
In article <at0k4t$hb5$1 digitaldaemon.com>, Christof Meerwald says...namespace ns1 { template<class T> struct A { A() { } // Error: namespace 'ns2' does not enclose member '?0' of namespace 'ns1'This is a really nasty one that tends to cause protection fault when compiled if the code base is large enoough. Richard
Dec 09 2002
In article <at0k4t$hb5$1 digitaldaemon.com>, Christof Meerwald says...namespace ns1 { template<class T> struct A { A() { } // Error: namespace 'ns2' does not enclose member '?0' of namespace 'ns1'Ok, after a retest, the code provided in Christof's test case causes a protection fault with .8 - as an aside, the dll version of the compiler is fine. smake produced -> SC -cpp -J -mn -C -WA -S -3 -a8 -c -gf -D_CONSOLE=1 -otest.obj test.cpp Richard
Dec 09 2002
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?
Dec 09 2002
namespace ns1 { struct A { static int value; }; int A::value = 0; } namespace ns2 { struct A { int f() { return ns1::A::value; // Error: 'A' must be a public base class of 'A' } }; } int main() { ns2::A a; return a.f(); } bye, Christof -- http://cmeerw.org JID: cmeerw jabber.at mailto cmeerw at web.de ...and what have you contributed to the Net?
Dec 09 2002
namespace ns { template<class T> struct A { }; typedef A<char> B; } using ns::B; struct C : public B // Error: undefined identifier 'B' { }; int main() { C c; return 0; } bye, Christof -- http://cmeerw.org JID: cmeerw jabber.at mailto cmeerw at web.de ...and what have you contributed to the Net?
Dec 11 2002
namespace ns { struct A { void f(); }; struct B { }; } void ns::A::f() { B b; // Error: undefined identifier 'B' } int main() { ns::A a; return 0; } (see 3.4.1 Unqualified name lookup [basic.lookup.unqual], paragraph 8, of the C++ Standard) bye, Christof -- http://cmeerw.org JID: cmeerw jabber.at mailto cmeerw at web.de ...and what have you contributed to the Net?
Dec 11 2002
#include <stdio.h> struct A { friend int f(int i) { return 1; } }; int f(long i) { return 0; } int main() { printf("%d\n", f(0)); } AFAIK, f(long) should be invoked and not f(int). See 7.3.1.2 Namespace member definitions [namespace.memdef], paragraph 3, of the C++ standard. bye, Christof -- http://cmeerw.org JID: cmeerw jabber.at mailto cmeerw at web.de ...and what have you contributed to the Net?
Dec 14 2002
Ah, no rest for the wicked <g>. "Christof Meerwald" <cmeerw web.de> wrote in message news:atgjkb$l63$1 digitaldaemon.com...#include <stdio.h> struct A { friend int f(int i) { return 1; } }; int f(long i) { return 0; } int main() { printf("%d\n", f(0)); } AFAIK, f(long) should be invoked and not f(int). See 7.3.1.2 Namespace member definitions [namespace.memdef], paragraph 3, of the C++ standard. bye, Christof -- http://cmeerw.org JID: cmeerw jabber.at mailto cmeerw at web.de ...and what have you contributed to the Net?
Dec 14 2002
Not sure if Christof posted this yet.. namespace one { template<class T> struct Types { typedef int Int; }; } template<class T, class U = one::Types<int>::Int> // Error: : no type for argument 'Int' // Internal error: struct 2797 struct Values { typedef U type; }; void main() { typedef Values<int>::type def; } I tried to find chapter and verse for this but could only find 14.6.4 Dependent name resolution.. and I'm not even sure it really applies. Man, Christof is really brilliant. How did he get so smart? Richard
Dec 15 2002
I believe DMC++ is behaving correctly here. f(int i) is not declared in a namespace, but in a non-local class, which according to 7.3.1.2-3 will become "a member of the innermost enclosing namespace", which in this instance is the global namespace. Hence, it should be found via normal overload rules. "Christof Meerwald" <cmeerw web.de> wrote in message news:atgjkb$l63$1 digitaldaemon.com...#include <stdio.h> struct A { friend int f(int i) { return 1; } }; int f(long i) { return 0; } int main() { printf("%d\n", f(0)); } AFAIK, f(long) should be invoked and not f(int). See 7.3.1.2 Namespace member definitions [namespace.memdef], paragraph 3, of the C++ standard. bye, Christof -- http://cmeerw.org JID: cmeerw jabber.at mailto cmeerw at web.de ...and what have you contributed to the Net?
Dec 17 2002
On Tue, 17 Dec 2002 01:12:13 -0800, Walter wrote:I believe DMC++ is behaving correctly here. f(int i) is not declared in a namespace, but in a non-local class, which according to 7.3.1.2-3 will become "a member of the innermost enclosing namespace", which in this instance is the global namespace. Hence, it should be found via normal overload rules.But the next sentence in the standard is: "The name of the friend is not found by simple name lookup until a matching declaration is provided in that namespace scope (either before or after the class declaration granting friendship).""Christof Meerwald" <cmeerw web.de> wrote in message news:atgjkb$l63$1 digitaldaemon.com...bye, Christof -- http://cmeerw.org JID: cmeerw jabber.at mailto cmeerw at web.de ...and what have you contributed to the Net?#include <stdio.h> struct A { friend int f(int i) { return 1; } }; int f(long i) { return 0; } int main() { printf("%d\n", f(0)); } AFAIK, f(long) should be invoked and not f(int). See 7.3.1.2 Namespace member definitions [namespace.memdef], paragraph 3, of the C++ standard.
Dec 17 2002
"Christof Meerwald" <cmeerw web.de> wrote in message news:atnudj$13hp$1 digitaldaemon.com...On Tue, 17 Dec 2002 01:12:13 -0800, Walter wrote:aI believe DMC++ is behaving correctly here. f(int i) is not declared inthatnamespace, but in a non-local class, which according to 7.3.1.2-3 will become "a member of the innermost enclosing namespace", which in this instance is the global namespace. Hence, it should be found via normal overload rules.But the next sentence in the standard is: "The name of the friend is not found by simple name lookup until a matching declaration is provided innamespace scope (either before or after the class declaration granting friendship)."True, but the example is a definition, not a declaration, which I believe changed things. Is this example from boost?
Dec 17 2002
Not sure about the analysis of this, but it works fine if I remove namespace definitions. namespace one { template<class T> struct A { }; template<class T> A<T>& fn(A<T>& t) { return t; } typedef A<int> Type; } using one::Type; using one::fn; void main() { Type i; Type j = fn(i); // ambiguous reference to symbol // Had: one::fn(A<T>&) // and: one::fn(A<T>&) } Richard
Dec 19 2002
On Tue, 17 Dec 2002 12:17:58 -0800, Walter wrote:"Christof Meerwald" <cmeerw web.de> wrote in message news:atnudj$13hp$1 digitaldaemon.com...Hmm, just found an example in the C++ standard, see 14.6.5 Friend names declared within a class template [temp.inject], paragraph 2. BTW, the example is not from Boost. It's inspired by some code from omniORB, but it's not causing any real trouble as most other compilers also get it wrong (including gcc 3.0) - but I am still hoping that I am right... bye, Christof -- http://cmeerw.org JID: cmeerw jabber.at mailto cmeerw at web.de ...and what have you contributed to the Net?On Tue, 17 Dec 2002 01:12:13 -0800, Walter wrote:aI believe DMC++ is behaving correctly here. f(int i) is not declared inthatnamespace, but in a non-local class, which according to 7.3.1.2-3 will become "a member of the innermost enclosing namespace", which in this instance is the global namespace. Hence, it should be found via normal overload rules.But the next sentence in the standard is: "The name of the friend is not found by simple name lookup until a matching declaration is provided innamespace scope (either before or after the class declaration granting friendship)."True, but the example is a definition, not a declaration, which I believe changed things. Is this example from boost?
Dec 22 2002
"Christof Meerwald" <cmeerw web.de> wrote in message news:au4cno$166n$1 digitaldaemon.com...BTW, the example is not from Boost. It's inspired by some code fromomniORB,but it's not causing any real trouble as most other compilers also get it wrong (including gcc 3.0) - but I am still hoping that I am right...Ok. I'll keep it on the active bug list for now, but I'll prioritize the other problems first. If practical, when you post bugs, let me know if they are showstoppers for your work or not. Thanks, -Walter
Dec 22 2002
I presume that goes for all of us, yes? Matthew "Walter" <walter digitalmars.com> wrote in message news:au4toe$1hl3$1 digitaldaemon.com..."Christof Meerwald" <cmeerw web.de> wrote in message news:au4cno$166n$1 digitaldaemon.com...itBTW, the example is not from Boost. It's inspired by some code fromomniORB,but it's not causing any real trouble as most other compilers also gettheywrong (including gcc 3.0) - but I am still hoping that I am right...Ok. I'll keep it on the active bug list for now, but I'll prioritize the other problems first. If practical, when you post bugs, let me know ifare showstoppers for your work or not. Thanks, -Walter
Dec 22 2002
Of course! "Matthew Wilson" <dmd synesis.com.au> wrote in message news:au5a23$1q33$1 digitaldaemon.com...I presume that goes for all of us, yes? Matthew "Walter" <walter digitalmars.com> wrote in message news:au4toe$1hl3$1 digitaldaemon.com..."Christof Meerwald" <cmeerw web.de> wrote in message news:au4cno$166n$1 digitaldaemon.com...itBTW, the example is not from Boost. It's inspired by some code fromomniORB,but it's not causing any real trouble as most other compilers also gettheywrong (including gcc 3.0) - but I am still hoping that I am right...Ok. I'll keep it on the active bug list for now, but I'll prioritize the other problems first. If practical, when you post bugs, let me know ifare showstoppers for your work or not. Thanks, -Walter
Dec 22 2002
"Walter" <walter digitalmars.com> schrieb im Newsbeitrag news:au4toe$1hl3$1 digitaldaemon.com...Ok. I'll keep it on the active bug list for nowWalter, how do you keep track of bugs and do you use a tool for this? Robert
Dec 23 2002
"Robert M. Münch" <robert.muench robertmuench.de> wrote in message news:au6tij$2v32$1 digitaldaemon.com..."Walter" <walter digitalmars.com> schrieb im Newsbeitrag news:au4toe$1hl3$1 digitaldaemon.com...Robert Oh, I just move them around between folders in Outlook.Ok. I'll keep it on the active bug list for nowWalter, how do you keep track of bugs and do you use a tool for this?
Dec 23 2002
namespace ns { struct B { }; struct A { A(B b); }; } ns::A::A(B b) // Error: ')' expected to close function parameter list with { } int main() { ns::B b; ns::A a(b); return 0; } bye, Christof -- http://cmeerw.org JID: cmeerw jabber.at mailto cmeerw at web.de
Dec 16 2002
namespace ns { const int A = 0; struct A { A() // Error: no constructor allowed for class 'A' { } }; struct B { }; } struct C : ns::B { C() : B() // Error: 'B' is not a member of struct 'C' { } }; int main() { C c; return 0; } See 9 Classes [class], paragraph 2, of the C++ standard. bye, Christof -- http://cmeerw.org JID: cmeerw jabber.at mailto cmeerw at web.de ...and what have you contributed to the Net?
Dec 21 2002
namespace ns { void f(); void g(); } void ns::f() { } void ns::g() { f(); // Error: undefined identifier 'f' } int main() { ns::g(); return 0; } See 3.4.1 Unqualified name lookup [basic.lookup.unqual], paragraph 6, of the C++ standard. bye, Christof -- http://cmeerw.org JID: cmeerw jabber.at mailto cmeerw at web.de ...and what have you contributed to the Net?
Dec 21 2002
void f(); namespace ns { using ::f; } using ns::f; int main() { f(); // Error: ambiguous reference to symbol return 0; } It's the same function (see 7.3.3 The using declaration [namespace.udecl], paragraph 10 and 3.3 Declarative regions and scopes [basic.scope], paragraph 4). Workaround is simple, so it's low priority. bye, Christof -- http://cmeerw.org JID: cmeerw jabber.at mailto cmeerw at web.de ...and what have you contributed to the Net?
Jan 01 2003
Quite similar to the previous one: void f(); namespace ns { using ::f; using ::f; } int main() { ns::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?
Jan 01 2003