https://bugs.llvm.org/show_bug.cgi?id=41995
Bug ID: 41995
Summary: [N2439] Clang does NOT issue a diagnostic on
ill-formed overloaded member functions
Product: clang
Version: 8.0
Hardware: All
OS: All
Status: NEW
Severity: enhancement
Priority: P
Component: C++11
Assignee: unassignedclangb...@nondot.org
Reporter: pclo...@gmail.com
CC: blitzrak...@gmail.com, dgre...@apple.com,
erik.pilking...@gmail.com, llvm-bugs@lists.llvm.org,
richard-l...@metafoo.co.uk
# Overview:
According to
[N2439](http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2439.htm),
> Member function declarations with the same name and the same
> parameter-type-list, as well as member function template declarations with
> the same name, the same parameter-type-list, and the same template parameter
> lists, cannot be overloaded if any of them, but not all, have a ref-qualifier
> (8.3.5).
# Steps to Reproduce:
```
class Base {
public:
void f() const {}
};
class Derived : public Base {
public:
using Base::f;
void f() & {}
void f() && {}
};
int main() {
const Derived cd;
cd.f();
return 0;
}
```
# Actual Results:
Clang compiles the above example without a diagnostic.
# Expected Results:
Clang issues a diagnostic.
# Build Date & Hardware:
clang version 8.0.0 (tags/RELEASE_800/final)
Target: x86_64-unknown-linux-gnu
Thread model: posix
# Additional Information:
- godbolt link to explore the example online.
- https://godbolt.org/z/vEYRIU
- x86-64 gcc 9.1 issues a diagnostic on the above example.
```
<source>: In function 'int square(int)':
<source>:15:10: error: passing 'const Derived' as 'this' argument discards
qualifiers [-fpermissive]
15 | cd.f();
| ^
<source>:9:7: note: in call to 'int Derived::f() &'
9 | int f() & { return 2; }
| ^
Compiler returned: 1
```
--
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