[LLVMbugs] [Bug 20769] New: Bogus conflict between default argument at block scope and namespace scope

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Aug 27 06:51:15 PDT 2014


http://llvm.org/bugs/show_bug.cgi?id=20769

            Bug ID: 20769
           Summary: Bogus conflict between default argument at block scope
                    and namespace scope
           Product: clang
           Version: trunk
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: hstong at ca.ibm.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

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

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20140827/1a6c1c23/attachment.html>


More information about the llvm-bugs mailing list