Date: Tue, 02 Mar 2010 16:13:00 +0200 From: Andriy Gapon <avg@freebsd.org> To: John Baldwin <jhb@freebsd.org>, Roman Divacky <rdivacky@freebsd.org> Cc: svn-src-projects@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r204537 - in projects/clangbsd/contrib/libstdc++: include/ext src Message-ID: <4B8D1CEC.7090707@freebsd.org> In-Reply-To: <4B8C5189.40102@freebsd.org> References: <201003012130.o21LUB0I022574@svn.freebsd.org> <201003011744.45410.jhb@freebsd.org> <4B8C5189.40102@freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
on 02/03/2010 01:45 Andriy Gapon said the following: > on 02/03/2010 00:44 John Baldwin said the following: >> On Monday 01 March 2010 4:30:11 pm Roman Divacky wrote: >>> Author: rdivacky >>> Date: Mon Mar 1 21:30:11 2010 >>> New Revision: 204537 >>> URL: http://svn.freebsd.org/changeset/base/204537 >>> >>> Log: >>> Make this a little more like C++. Clang++ can grok all libstdc++ >>> now. >>> >>> Modified: >>> projects/clangbsd/contrib/libstdc++/include/ext/ropeimpl.h >>> projects/clangbsd/contrib/libstdc++/src/locale-inst.cc >>> >>> Modified: projects/clangbsd/contrib/libstdc++/include/ext/ropeimpl.h >>> >> ============================================================================== >>> --- projects/clangbsd/contrib/libstdc++/include/ext/ropeimpl.h Mon Mar 1 >> 21:04:10 2010 (r204536) >>> +++ projects/clangbsd/contrib/libstdc++/include/ext/ropeimpl.h Mon Mar 1 >> 21:30:11 2010 (r204537) >>> @@ -382,7 +382,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) >>> { >>> _Rope_RopeLeaf<_CharT, _Alloc>* __l >>> = (_Rope_RopeLeaf<_CharT, _Alloc>*)this; >>> - __l->_Rope_RopeLeaf<_CharT, _Alloc>::~_Rope_RopeLeaf(); >>> + __l->template _Rope_RopeLeaf<_CharT, _Alloc>::~_Rope_RopeLeaf(); >>> _L_deallocate(__l, 1); >>> break; >>> } >> Hmm, this hurts my brain to have 'template ' in the middle of a dereference. > > Meet the beauty of modern C++. You can find a similar usage of 'typename' > keyword too. > > >> I also don't see why it should be needed. > > Hmm, I am not sure too, I think that the changed line could be simply written as > follows without any ambiguity: > __l->~_Rope_RopeLeaf(); > but our base c++ complains about that construct, c++ 4.3, 4.4 and 4.5 from ports > happily accept all three forms. > clang++ from llvm-devel-2.7.r96348_1 didn't like any of the forms. Update: after upgrade to llvm-devel-2.7.r97497 only the old variant is rejected, new variant and my proposed variant are accepted. > I am not a C++ expert by any stretch, though. > Here is some minimalistic test code: > //************************************** > template<typename T> > struct B > { > B() {} > ~B() {} > }; > > template<typename T> > struct S : public B<T> > { > S() {} > ~S() {} > }; > > template<typename T> > struct C > { > void f() > { > S<T>* s = reinterpret_cast<S<T>*>(this); > s->~S(); > s->S<T>::~S(); > s->template S<T>::~S(); > } > }; > > //************************************** -- Andriy Gapon
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4B8D1CEC.7090707>