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: PING: [PATCH: c++/diagnostic/18313] Warn for pointless qualifiers on return type


Dirk Mueller <dmuell@gmx.net> writes:

| On Monday, 27. November 2006 03:23, Gabriel Dos Reis wrote:
| 
| > |         * pt.c (tsubst_function_type): Warn for type qualifiers on
| > |         return type for dependent types.
| > This ChangeLog entry seems to indicate that we warn even for dependent
| > type, when in fact I was suggesting to warn only for non-dependent type.
| 
| We're warning for the non-dependent case, e.g. for this:
| 
| template<typename T> struct S {
|   const int f() const;
|   const T g() const;
|   T h() const;
| };
| 
| we will only warn for f() in the "normal" case. if the instantiation has a cv 
| qualifier, we will warn on h() as well (but not on g()). As far as I 
| understood, this was the consensus. 

Thanks!  That part is OK then.

| 
| If you have a better way to describe this behaviour, please tell me. I'd also 
| be interested if the TREE_NO_WARNING on the type node has any undesired 
| side-effect (there was none exposed by the testsuite). 

This part makes be a bit incomfortable.  As we're moving to unified
type nodes, we should not be setting the TREE_NO_WARNING flag for this
type -- I know that at the current stage, we don't share function
types, so your change is OK.  
But actually, we wanted to suppress the warning for that particular
decl, so we should be saying that.  Do you think you can arrange for
the TREE_NO_WARNING be set on the FUNCTION_DECL (or maybe on its
DECL_RESULT I'm not sure which is better) instead of its type?  

-- Gaby


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