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: unassignedclangb...@nondot.org
Reporter: Luna+llvmbugs@baguette.management
CC: blitzrak...@gmail.com, dgre...@apple.com,
erik.pilking...@gmail.com, llvm-bugs@lists.llvm.org,
richard-l...@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs