<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 --- - C++11-style sizeof does not compile in certain cases."
   href="http://llvm.org/bugs/show_bug.cgi?id=19266">19266</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>C++11-style sizeof does not compile in certain cases.
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

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

        <tr>
          <th>OS</th>
          <td>All
          </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>astellar@ro.ru
          </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>Consider this artificial code:

    struct foo
    {
        int bar;
    };

    template <typename T>
    struct A { };

    template <typename T>
    struct B : public A<T>
    {
        void baz()
        {
            enum { count = sizeof(foo::bar) };
        }
    };

    int main(int, char *[])
    {
        B<int>().baz();
        return 0;
    }

clang++ -std=c++11 bug.cpp produces following output:

    bug.cpp:14:36: fatal error: 'foo::bar' is not a member of class 'B<int>'
            enum { count = sizeof(foo::bar) };
                                  ~~~~~^
    bug.cpp:20:14: note: in instantiation of member function 'B<int>::baz'
requested here
        B<int>().baz();

I see this error with both clang 3.4 on Linux and 3.5.r203967 snapshot on
Windows, so I
suppose that it fails in trunk too (can't test it unfortunately). Compilation
does not
fail if:
    - B::baz is turned into static function;
    - enum is moved to struct B's scope;
    - I use sizeof(static_cast<foo*>(0)->bar) instead of sizeof(foo::bar);
    - A and/or B are not template types.

GCC 4.8 compiles this code without errors.</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>