<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 --- - Class constructor default argument fails to compile"
   href="http://llvm.org/bugs/show_bug.cgi?id=15686">15686</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Class constructor default argument fails to compile
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </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>new bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>MyAdEss@seznam.cz
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>If a class constructor has an argument that takes a default value that itself
is a template of more than one parameter, it fails to compile.

Example of a full program:
<a href="http://ideone.com/mv9Qco">http://ideone.com/mv9Qco</a>
/***************************************************/
#include <functional>
using namespace std;

/* a function template */
template <typename A, typename B>
A f(B) { return A(); }

/* a class template */
template <typename A, typename B>
class X {};

template <typename A, typename B>
class Y
{
  /** All these constructors fail to compile **/

  Y(X<A,B> = X<A,B>())
  //Y(A (*arg)(B) = f<A, B>)
  //Y(std::function<A(B)> arg = f<A, B>)
  { }
};

int main()
{ return 0; }
/***************************************************/

It compiles successfully on GCC and MSVC.

Compiler error:
clangtest.cpp:17:19: error: expected ')'
  Y(X<A,B> = X<A,B>())
                  ^
clangtest.cpp:17:4: note: to match this '('
  Y(X<A,B> = X<A,B>())
   ^
clangtest.cpp:17:17: error: expected '>'
  Y(X<A,B> = X<A,B>())
                ^
2 errors generated.


--Floop</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>