<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 --- - Default argument added afterwards to a function imported with using-statement won't be visible"
   href="http://llvm.org/bugs/show_bug.cgi?id=21260">21260</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Default argument added afterwards to a function imported with using-statement won't be visible
          </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>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>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>tuomas.tynkkynen@iki.fi
          </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>Created <span class=""><a href="attachment.cgi?id=13196" name="attach_13196" title="First testcase.">attachment 13196</a> <a href="attachment.cgi?id=13196&action=edit" title="First testcase.">[details]</a></span>
First testcase.

With clang version 3.6.0 (trunk 219614) (llvm/trunk 219612), the following
doesn't compile, while several versions of g++ accept it.

////////////////
namespace A {
    int f(int x);
}

using A::f;

namespace A {
    int f(int x = 1);
}

int a = f();
////////////////

clang++ -std=c++11 default-param.cpp results in:

----------------
default-param.cpp:11:9: error: no matching function for call to 'f'
int a = f();
        ^
default-param.cpp:2:9: note: candidate function not viable: requires single
argument 'x', but no arguments were provided
    int f(int x);
        ^
1 error generated.
-----------------

i.e. even though a default argument was added afterwards to A::f, it's not
visible at ::f. N3485 section 8.3.6p9 (page 186) states:

When a declaration of a function is introduced by way of a using-declaration
(7.3.3), any default argument information associated with the declaration is
made known as well. If the function is redeclared thereafter in the namespace
with additional default arguments, the additional arguments are also known at
any point following the redeclaration where the using-declaration is in scope.

This suggests that clang's behaviour is wrong in this case. One different case
where clang also disagrees with GCC is array redeclarations with:

/////////
namespace A {
    extern int x[];
}

using A::x;

namespace A {
    int x[2];
}

constexpr unsigned long s = sizeof(x);
///////////

which results in

arr.cpp:11:35: error: invalid application of 'sizeof' to an incomplete type
'int []'
constexpr unsigned long s = sizeof(x);
                                  ^~~

I'm not sure what behaviour is correct in this case.</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>