[llvm-bugs] [Bug 47789] New: Clang 10 disallows modifying const member by an unused member function in a templated class; while Clang 9 allows it

via llvm-bugs llvm-bugs at lists.llvm.org
Sat Oct 10 12:08:00 PDT 2020


https://bugs.llvm.org/show_bug.cgi?id=47789

            Bug ID: 47789
           Summary: Clang 10 disallows modifying const member by an unused
                    member function in a templated class; while Clang 9
                    allows it
           Product: clang
           Version: 10.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: jjkoshy at gmail.com
                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

Created attachment 24042
  --> https://bugs.llvm.org/attachment.cgi?id=24042&action=edit
Sample program demonstrating the issue

I'm not sure this is a bug or not.

- The sample program has a class template with a const member.
- A member function attempts to modify the member.
- The program does not actually use that member function
- Clang 9 and gcc compile the code fine, while clang 10 gives an error.

I see this behavior only with template classes, so I was thinking it may be a
case of SFINAE (in which case clang 10 should not be giving an error). However,
some others on cpplang slack are of the opinion this is a case of IFNDR, and
clang 10 is basically issuing eager diagnostics.

Code is here https://godbolt.org/z/r9sT44

and also attached to this report

-- 
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/20201010/4a069391/attachment.html>


More information about the llvm-bugs mailing list