This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [c++] Keep tm, div_t, ldiv_t, lconv mangling on Solaris (PR libstdc++-v3/1773)


On Tue, 16 Aug 2011, Rainer Orth wrote:

thanks for the hint. This resulted in a far cleaner patch indeed.

Cool, thanks.


* config/sol2-cxx.c

You are missing a closing parenthesis in there, on the line with DECL_NAMESPACE_STD_P. I hadn't dared modify DECL_CONTEXT(decl) because I was afraid of side effects.


For instance, in:
namespace std { struct tm {}; }
//void f(std::tm){}
void g(tm){}

uncommenting the middle line turns the error message from:
e.cc:3:10: error: variable or field 'g' declared void
e.cc:3:8: error: 'tm' was not declared in this scope
e.cc:3:8: note: suggested alternative:
e.cc:1:24: note:   'std::tm'

to:
e.cc:3:10: error: variable or field 'g' declared void
e.cc:3:8: error: 'tm' was not declared in this scope
e.cc:3:8: note: suggested alternative:
e.cc:1:24: note:   'tm'

It also breaks argument-dependent lookup:
namespace std { struct tm {}; void h(tm){} }
void g(std::tm x){ h(x); }

On the other hand, there probably isn't much ADL going on with these 4 types...

It might be less invasive to have decl_mangling_context return global_namespace without actually modifying the expr?

(as already mentioned, I don't know much about gcc internals, I am just commenting from my experience writing the previous draft patch)

--
Marc Glisse


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]