<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - diagnostics: no viable overloaded operator[]: Display second operand"
   href="https://llvm.org/bugs/show_bug.cgi?id=28587">28587</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>diagnostics: no viable overloaded operator[]: Display second operand
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>3.8
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>-New Bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>jan.kratochvil@redhat.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>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.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>