[LLVMbugs] [Bug 22404] New: Base class init error

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Jan 30 05:42:31 PST 2015


            Bug ID: 22404
           Summary: Base class init error
           Product: clang
           Version: 3.5
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: d.v.a at ngs.ru
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Clang 3.5.1 fails to compile this code:


struct file_stat : public ::stat
    file_stat(const struct ::stat &s) : ::stat(s) {}

int main()
    struct ::stat s;
    file_stat s2(s);

with error:

clang-bug.cpp:5:43: error: member initializer 'stat' does not name a non-static
data member or base class
    file_stat(const struct ::stat &s) : ::stat(s) {}

GCC accepts this code silently. This workaround works for Clang:

struct file_stat : public ::stat
    typedef struct ::stat base;
    file_stat(const struct ::stat &s) : base(s) {}

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/20150130/96b161b0/attachment.html>

More information about the llvm-bugs mailing list