<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 conflict between default argument at block scope and namespace scope"
   href="http://llvm.org/bugs/show_bug.cgi?id=20769">20769</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Bogus conflict between default argument at block scope and namespace scope
          </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++
          </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>Rejects valid when a function is first declared at block scope with default
arguments and later declared with default arguments at namespace scope.

In the source below, the block scope declaration does not introduce "foo" into
the namespace scope (ref: C++03 3.5 [basic.link]/7). The declaration of "foo"
on the second line is the only declaration of it in the namespace scope.

The block scope declaration and the namespace scope declaration should be
considered to have completely distinct sets of default arguments (ref: C++03
8.3.6 [dcl.fct.default]/4).

### SOURCE:
$ cat blockDefault.cc 
void bar() { void foo(int = 1); }
void foo(int = 0);


### COMPILER INVOCATION AND OUTPUT:
$ clang -cc1 -x c++ -std=c++03 blockDefault.cc
blockDefault.cc:2:14: error: redefinition of default argument
void foo(int = 0);
             ^ ~
blockDefault.cc:1:27: note: previous definition is here
void bar() { void foo(int = 1); }
                          ^ ~
1 error generated.


### COMPILER VERSION INFO:
$ clang++ -v
clang version 3.6.0 (trunk 215824)
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>