[Bug c++/56763] New: "attribute ignored in declaration of " warning points to wrong place

kai.koehne at digia dot com gcc-bugzilla@gcc.gnu.org
Thu Mar 28 12:48:00 GMT 2013


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56763

             Bug #: 56763
           Summary: "attribute ignored in declaration of " warning points
                    to wrong place
    Classification: Unclassified
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: kai.koehne@digia.com


When putting an attribute at the wrong place in a friends declaration, gcc does
point incorrectly to the actual class declaration. E.g.


--
class __attribute__((visibility("default"))) X {
};

class Y {
    friend __attribute__((visibility("default"))) class X;
};

int main(int , char *[])
{
}
--

will print

--
./gccattributewarning/main.cpp:1:46: warning: attribute ignored in declaration
of 'class X' [-Wattributes]
 class __attribute__((visibility("default"))) X {
                                              ^
../gccattributewarning/main.cpp:1:46: note: attribute for 'class X' must follow
the 'class' keyword
--

. What I would have expected is that it points to main.cpp:5 instead.



More information about the Gcc-bugs mailing list