<html>
    <head>
      <base href="http://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 --- - static const member is not a constant expression when accessed from reference with 'dot' operator and used as a template parameter"
   href="http://llvm.org/bugs/show_bug.cgi?id=16860">16860</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>static const member is not a constant expression when accessed from reference with 'dot' operator and used as a template parameter
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>3.3
          </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>normal
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>C++11
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>darkdragon1@free.fr
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>dgregor@apple.com, llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=11021" name="attach_11021" title="code generating compile error in clang but not in gcc">attachment 11021</a> <a href="attachment.cgi?id=11021&action=edit" title="code generating compile error in clang but not in gcc">[details]</a></span>
code generating compile error in clang but not in gcc

In c++11, it is possible to access static member variables just like regular
members with the 'dot' operator. This is of course implemented in clang.
However, the attached code does not compile with clang, and does with gcc
(4.7).

In other words: when trying to access the static member 'test::value' from 't',
which is of type 'test', everything is fine. But if one binds 't' to a
reference 'rt' (of type 'test&'), 'rt.value' is not considered a compile time
constant anymore. As an excuse, clang says that the "initializer of 'rt' is not
a constant expression".

I guess this is a bug because using 'rt.value' as the dimension of an array is
perfectly fine with both compilers.</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>