This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/47347] New: "pragma GCC diagnostic ignored" has no effect sometimes
- From: "gcc at dpinol dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 18 Jan 2011 16:46:12 +0000
- Subject: [Bug c++/47347] New: "pragma GCC diagnostic ignored" has no effect sometimes
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47347
Summary: "pragma GCC diagnostic ignored" has no effect
sometimes
Product: gcc
Version: 4.5.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: gcc@dpinol.com
The code below produces warning "warning: unused parameter âaâ
[-Wunused-parameter]" were it shouldn't, since this diagnostic should be
ignored.
If we remove the final line, the warning does not appear, but I understand that
a pragma should not affect previous lines.
#pragma GCC diagnostic ignored "-Wunused-parameter"
#include <vector>
template <class ContainerAllocator>
struct KeyValue
{
public:
virtual ~KeyValue()
{
}
virtual void serialize(int a) const
{
}
};
void f()
{
std::vector< KeyValue<int > > values;
}
#pragma GCC diagnostic warning "-Wunused-parameter"