[llvm-bugs] [Bug 28587] New: diagnostics: no viable overloaded operator[]: Display second operand

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Jul 17 04:35:57 PDT 2016


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

            Bug ID: 28587
           Summary: diagnostics: no viable overloaded operator[]: Display
                    second operand
           Product: clang
           Version: 3.8
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: jan.kratochvil at redhat.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

int a[1];
class C {} c;
int main() { ++a[c]; }

clang-3.8.0-2.fc24.x86_64
/tmp/1j.C:3:17: error: no viable overloaded operator[] for type 'int [1]'
int main() { ++a[c]; }
               ~^~

gcc-6.1.1-3.fc24.x86_64
/tmp/1j.C: In function ‘int main()’:
/tmp/1j.C:3:17: error: no match for ‘operator[]’ (operand types are ‘int [1]’
and ‘C’)
 int main() { ++a[c]; }
                 ^

It was unclear for me why the error is reported by clang (sure in a more
complicated real world case).  I had to use GCC to make it clear to me.

-- 
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/20160717/f8830aef/attachment.html>


More information about the llvm-bugs mailing list