[cfe-dev] Incorrect location of a friend declaration

Dimitar Dobrev dpldobrev at yahoo.com
Sun May 3 07:49:38 PDT 2015


    Hi all,
    I have the following header:


    class Class1
    {
    };

    class Class2
    {
    public:
        friend inline const Class1 operator+(const Class1& f1, const Class1& f2);
    };

    inline const Class1 operator+(const Class1& f1, const Class1& f2)
    {
        return Class1();
    }


    Decl::getLocation() returns line 8 for the friend - that's correct. But it returns 8 for the friend declaration, that is, the function itself, too, while the function is actually located at line 11. If the friend is deleted, then the correct location is reported.
    I think it's a bug so I filed it at https://llvm.org/bugs/show_bug.cgi?id=23401 . But I may me wrong so I'd appreciate your opinion.

    Dimitar Dobrev
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20150503/b43464be/attachment.html>


More information about the cfe-dev mailing list