[cfe-dev] Incorrect location of a friend declaration

Nikola Smiljanic popizdeh at gmail.com
Sun May 3 17:36:09 PDT 2015


If I understand correctly you think that FunctionDecl at line 8 should
point to line 11? That doesn't seem right, what you have at line 8 really
is a function declaration. What you have at line 11 is the definition of
previously declared function.

On Mon, May 4, 2015 at 12:49 AM, Dimitar Dobrev <dpldobrev at yahoo.com> wrote:

>
>     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
>
>
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20150504/60080d7f/attachment.html>


More information about the cfe-dev mailing list