<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 --- - Bogus parsing derivation of enum-base from type-specifier-seq"
   href="http://llvm.org/bugs/show_bug.cgi?id=19810">19810</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Bogus parsing derivation of enum-base from type-specifier-seq
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>3.4
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>Other
          </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>hstong@ca.ibm.com
          </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>Source code which parses with C++03 fails when using Clang's implementation of
C++11.
>From the grammar in N3290, it seems an enum-base may only appear before '{' or
';'.
It looks like the Clang parser picked a production which failed and did not
backtrack.

ICC (which does understand enum-base) does not have this problem.

### SOURCE:> cat enumBaseVersusConditional.cc
enum E { E1 };
void foo() {
   false ? new enum E : int();
}
Return:  0x00:0


### COMPILER INVOCATION AND OUTPUT:> clang++ -std=c++11
enumBaseVersusConditional.cc -c
enumBaseVersusConditional.cc:3:25: error: non-integral type 'int ()' is an
invalid underlying type
   false ? new enum E : int();
                        ^
enumBaseVersusConditional.cc:3:30: error: expected ':'
   false ? new enum E : int();
                             ^
                             :
enumBaseVersusConditional.cc:3:10: note: to match this '?'
   false ? new enum E : int();
         ^
enumBaseVersusConditional.cc:3:30: error: expected expression
   false ? new enum E : int();
                             ^
3 errors generated.
Return:  0x01:1


### EXPECTED OUTPUT:> clang++ -std=c++03 enumBaseVersusConditional.cc -c
Return:  0x00:0


### VERSION INFO:> clang++ -v
clang version 3.4
Target: powerpc64-unknown-linux-gnu
Thread model: posix
Found candidate GCC installation: /usr/lib/gcc/ppc64-redhat-linux/4.4.4
Found candidate GCC installation: /usr/lib/gcc/ppc64-redhat-linux/4.4.6
Selected GCC installation: /usr/lib/gcc/ppc64-redhat-linux/4.4.6
Return:  0x00:0</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>