[llvm-bugs] [Bug 37850] New: clang++ rejects legal code
via llvm-bugs
llvm-bugs at lists.llvm.org
Tue Jun 19 04:06:26 PDT 2018
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: unassignedclangbugs at nondot.org
Reporter: zhonghao at pku.org.cn
CC: dgregor at apple.com, llvm-bugs at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20180619/acf99c58/attachment.html>
More information about the llvm-bugs
mailing list