<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 --- - Narrowing conversion from enum to float missed: fails to cause substitution failure"
   href="http://llvm.org/bugs/show_bug.cgi?id=20669">20669</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Narrowing conversion from enum to float missed: fails to cause substitution failure
          </td>
        </tr>

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

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

        <tr>
          <th>Hardware</th>
          <td>All
          </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>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>A narrowing conversion from an unscoped enumeration to a floating-point type
does not trigger substitution failure in Clang.
The similar narrowing conversion from long long to float does.

ref: N3290 subclause 8.5.4 [dcl.init.list] paragraph 7.

### SOURCE:
$ cat narrowingEnumToFloat.cc
enum AA : long long { A = -1, B = 0x7fffffffffffffffLL } a;

template <typename T> void foo(T, char (*)[sizeof T{ a }] = 0);
int foo(int);

int main() {
   return foo(0.f);
}


### COMPILER INVOCATION AND OUTPUT:
$ clang -cc1 -std=c++11 -x c++ narrowingEnumToFloat.cc 
narrowingEnumToFloat.cc:7:11: error: cannot initialize return object of type
'int' with an rvalue of type 'void'
   return foo(0.f);
          ^~~~~~~~
1 error generated.


### EXPECTED OUTPUT:
Successful compile.


### COMPILER VERSION INFO:
$ clang++ -v
clang version 3.5.0 (trunk 214060)
Target: x86_64-unknown-linux-gnu
Thread model: posix
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8.2
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9.0
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8
Candidate multilib: .;@m64
Selected multilib: .;@m64</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>