Template and inheritance member-function lookup

1,484 views
Skip to first unread message

Robin Le Bihan

unread,
Mar 9, 2019, 8:05:25 PM3/9/19
to ISO C++ Standard - Discussion
Hi,

I came across a very odd compile error and I was wondering if this
could be a language defect. This error regards access to members
of an inherited templated class from inside the inheriting templated
class.

The bogus code can be found here: https://godbolt.org/z/Thcaq0. The
error seems to occur on GCC and Clang. However, there is no such
error on MSVC.

The lookup for member-function bar only seems to work when
bar is qualified. If this behavior is not a defect and is perfectly intended,
I would appreciate an enlightment on how the lookup is done in that
very case.

Best regards,

-- 
Robin "CueBrick" Le Bihan
Teaching assistant at EPITA
Image synthesis student

Language Lawyer

unread,
Mar 9, 2019, 8:11:06 PM3/9/19
to std-dis...@isocpp.org
On 10/03/2019 04:05, Robin Le Bihan wrote:
> Hi,
>
> I came across a very odd compile error and I was wondering if this
> could be a language defect. This error regards access to members
> of an inherited templated class from inside the inheriting templated
> class.
>
> The bogus code can be found here: https://godbolt.org/z/Thcaq0. The
> error seems to occur on *GCC *and *Clang*. However, there is no such
> error on *MSVC*.

https://godbolt.org/z/8xfCPw there is an error on MSVC if you ask it not to be permissive.

> The lookup for member-function bar only seems to work when
> bar is qualified. If this behavior is not a defect and is perfectly
> intended,
> I would appreciate an enlightment on how the lookup is done in that
> very case.

Ask your favorite search engine about "two phase lookup"

Robin Le Bihan

unread,
Mar 9, 2019, 8:22:47 PM3/9/19
to ISO C++ Standard - Discussion
Le dimanche 10 mars 2019 02:11:06 UTC+1, Language Lawyer a écrit :
Ask your favorite search engine about "two phase lookup"

Thank you for the quick answer and the hint about two phase lookup. :)
Reply all
Reply to author
Forward
0 new messages