[llvm-bugs] [Bug 38761] New: Argument dependent lookup fails for a class nested in its base
via llvm-bugs
llvm-bugs at lists.llvm.org
Wed Aug 29 07:57:57 PDT 2018
https://bugs.llvm.org/show_bug.cgi?id=38761
Bug ID: 38761
Summary: Argument dependent lookup fails for a class nested in
its base
Product: clang
Version: 7.0
Hardware: PC
OS: FreeBSD
Status: NEW
Severity: normal
Priority: P
Component: -New Bugs
Assignee: unassignedclangbugs at nondot.org
Reporter: martin.beran at kernun.cz
CC: llvm-bugs at lists.llvm.org
The following code does not compile:
struct base {
friend const base* enable_base(const base* b) { return b; }
};
struct a: base {
struct b;
};
struct a::b: a {
};
struct ptr {
void get_base() { a::b* obj = nullptr; enable_base(obj); }
};
int main()
{
ptr().get_base();
return 0;
}
$ c++ -o err err.cpp --std=c++17pokus.cpp:15:44: error: use of undeclared
identifier 'enable_base'
void get_base() { a::b* obj = nullptr; enable_base(obj); }
^
1 error generated.
I think that ADL should add 'base' into the set of associated classes and find
friend enable_base, because 'base' is an indirect base of 'a::b' and a direct
base of 'a', which 'a::b' is nested in. I tested this behavior on FreeBSD 11.2
with Clang 6.0.0, 6.0.1, and 7.0.0 rc1, also on Ubuntu 18.04 with Clang 6.0.0.
GCC 7.3.0 on Ubuntu 18.04 compiles this code without the error. Un-nesting 'b'
from 'a' eliminates the error on all tested versions of Clang.
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20180829/2e8bbc4a/attachment.html>
More information about the llvm-bugs
mailing list