<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 --- - Mysterious error with inheriting constructor, delegating constructor, and noexcept specifier"
   href="http://llvm.org/bugs/show_bug.cgi?id=15757">15757</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Mysterious error with inheriting constructor, delegating constructor, and noexcept specifier
          </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>Windows NT
          </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>eric@boostpro.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>This is as far as I've been able to narrow this problem down. It seems to be
some strange confluence of C++11 features that is causing the perfect storm:

{{{
    struct S
    {};

    template<typename X, typename Y>
    struct T
    {
        template<typename A>
        T(X x, A &&a)
        {}

        template<typename A>
        explicit T(A &&a)
            noexcept(noexcept(
                T(X(), static_cast<A &&>(a))
            ))
          : T(X(), static_cast<A &&>(a))
        {}
    };

    template<typename X, typename Y>
    struct U
      : T<X, Y>
    {
        using T<X, Y>::T;
    };

    // Comment this function out and everything works
    U<S, char> foo(char ch)
    {
        return U<S, char>(ch);
    }

    int main()
    {
        U<S, int>  a(42);   // This works
        U<S, char> b('4');  // This fails
    }
}}}

The error I'm getting is:

1>  "C:/cygwin/usr/local/bin/clang++.exe" -c -O0 -std=gnu++11 main.cpp -o
main.o
1>  main.cpp:14:20: error: cannot cast from lvalue of type 'char' to rvalue
reference type 'S &&'; types are not compatible
1>              T(X(), static_cast<A &&>(a))
1>                     ^~~~~~~~~~~~~~~~~~~~
1>  main.cpp:24:20: note: in instantiation of exception specification for
'T<char>' requested here
1>      using T<X, Y>::T;
1>                     ^
1>  main.cpp:36:16: note: inheriting constructor for 'U<S, char>' first
required here
1>      U<S, char> b('4');  // This fails
1>                 ^
1>  1 error generated.

I can't make any sense of the error message. Seemingly innocuous changes to the
code, like commenting out the foo function or the noexcept clause, make the
error go away.</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>