[llvm-bugs] [Bug 44699] New: Members of nested classes incorrectly shadow template parameters of member functions of the nested class
via llvm-bugs
llvm-bugs at lists.llvm.org
Tue Jan 28 13:32:27 PST 2020
https://bugs.llvm.org/show_bug.cgi?id=44699
Bug ID: 44699
Summary: Members of nested classes incorrectly shadow template
parameters of member functions of the nested class
Product: clang
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: C++
Assignee: unassignedclangbugs at nondot.org
Reporter: Luna+llvmbugs at baguette.management
CC: blitzrakete at gmail.com, dgregor at apple.com,
erik.pilkington at gmail.com, llvm-bugs at lists.llvm.org,
richard-llvm at metafoo.co.uk
Example code:
class Outer {
class Inner {
int x;
template <int x>
void static check() {
static_assert(x < 10);
}
};
};
Produces the error
<source>:7:27: error: invalid use of member 'x' in static member function
static_assert(x < 10);
^
(Compiler explorer: https://gcc.godbolt.org/z/pC_Mx8)
x in check() should refer to the template parameter but apparently refers to
the member variable of the same name. If class Inner is declared at global
scope (i.e. not nested in class Outer), x correctly refers to the template
parameter instead of the member variable.
--
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/20200128/9ad5886a/attachment.html>
More information about the llvm-bugs
mailing list