https://bugs.llvm.org/show_bug.cgi?id=37850

            Bug ID: 37850
           Summary: clang++ rejects legal code
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
          Assignee: unassignedclangb...@nondot.org
          Reporter: zhong...@pku.org.cn
                CC: dgre...@apple.com, llvm-bugs@lists.llvm.org

The code is as follow:

# 3 "bug3.cc"
class Z {
public:


 Z(int);

private:
 int i;
};
Z::Z(int j=43): i(j){}


int main()
{
 Z zobject=Z();

}

clang++ produces the following errors:
 bug3.cc:12:10: error: addition of default argument on redeclaration makes this
constructor a default constructor
    Z::Z(int j=43): i(j){}
             ^ ~~
    bug3.cc:7:2: note: previous declaration is here

The code comes from a gcc bug report:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=2189

A previous version of g++ also rejects the above code, but it is fixed.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to