Bug 33801 - Missing warning: "type qualifiers are meaningless in this declaration"
Summary: Missing warning: "type qualifiers are meaningless in this declaration"
Status: RESOLVED INVALID
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.3.0
: P3 enhancement
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: diagnostic
Depends on:
Blocks:
 
Reported: 2007-10-17 17:36 UTC by Paolo Carlini
Modified: 2011-10-22 13:08 UTC (History)
4 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Paolo Carlini 2007-10-17 17:36:55 UTC
For this kind of code:

struct cont
{
  typedef const int& const_reference;
};

template<typename C>
struct iter
{
  void
  f(const typename C::const_reference value)
  { }
};

int main()
{
  iter<cont> it;
  it.f(5);
}

we do not emit any warning for the 'const' in the signature of f. We simply ignore it. The EDG front-end does.
Comment 1 Manuel López-Ibáñez 2010-02-21 01:06:48 UTC
What does EDG say? What is the problem? This bug summary is too vague.
Comment 2 Wolfgang Bangerth 2010-02-21 01:27:57 UTC
I don't see what should be warned about. The 'const' in the signature of
'f' has no effect here, but it also doesn't hurt -- its presence or
absence simply doesn't make a difference.

W.
Comment 3 Manuel López-Ibáñez 2010-07-06 17:34:17 UTC
3 years in waiting... I am closing this, we have too many real bugs open to worry about.
Comment 4 Paolo Carlini 2010-07-06 18:18:40 UTC
Sorry about the delay. The warning emitted by current ICC by default is exactly:

33801.C(10): warning #21: type qualifiers are meaningless in this declaration
    f(const typename C::const_reference value)
      ^
          detected during instantiation of class "iter<C> [with C=cont]" at line 16

Likewise VC++, for example. Let's keep this open for a while.
Comment 5 Manuel López-Ibáñez 2011-10-22 12:07:48 UTC
What is the difference between this and this testcase:

typedef const double* const_double;     
void foo(const const_double);

Neither C nor C++ warn here with -Wall -Wextra. Clang neither warns in the original testcase. I don't see how the const can hurt.

Anyway, adding a better description...
Comment 6 Paolo Carlini 2011-10-22 13:08:04 UTC
Ok guys, let's close this.