PING: [PATCH: c++/diagnostic/18313] Warn for pointless qualifiers on return type

Gabriel Dos Reis
Tue Nov 28 11:46:00 GMT 2006

Dirk Mueller <> 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

More information about the Gcc-patches mailing list