[LLVMbugs] [Bug 8674] New: bewildering error message: cannot initialize a parameter of type 'struct stat *' with an rvalue of type 'struct stat *'

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Nov 23 10:57:58 PST 2010


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

           Summary: bewildering error message: cannot initialize a
                    parameter of type 'struct stat *' with an rvalue of
                    type 'struct stat *'
           Product: clang
           Version: unspecified
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: clattner at apple.com
                CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com


I got this today (where 'baz' was 'stat', renamed to be a little less
confusing):

t.cc:14:16: error: cannot initialize a parameter of type 'struct stat *' with
an
      rvalue of type 'struct stat *'
  ::baz("foo", &X);
               ^~
t.cc:10:36: note: passing argument to parameter here
void baz(const char*, struct stat *);
                                   ^

This is incredibly confusing and took me a long time to figure out what was
going wrong.  Here's the reduced input:


namespace clang {
class foo {
  void bar(struct stat &X);
};
}

struct stat;
void baz(const char*, struct stat *);

using namespace clang;
void foo::bar(struct stat &X) {
  ::baz("foo", &X);
}

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list