[LLVMbugs] [Bug 7402] New: Incorrect "initializing multiple members" error, which lacks a SourceLocation

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Jun 17 14:59:14 PDT 2010


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

           Summary: Incorrect "initializing multiple members" error, which
                    lacks a SourceLocation
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: jyasskin at google.com
                CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com


$ cat test.cc
struct MyStruct {
  union {
    void* ptr_;
    struct { int i_; };
  };

  template <typename T> MyStruct(T) : ptr_(0) { }
};

void f() {
  MyStruct s(3);
}
$ clang++ -fsyntax-only  test.cc
error: initializing multiple members of anonymous union
test.cc:11:12: note: in instantiation of function template specialization
      'MyStruct::MyStruct<int>' requested here
  MyStruct s(3);
           ^
test.cc:7:39: note: previous initialization is here
  template <typename T> MyStruct(T) : ptr_(0) { }
                                      ^~~~~~~
1 error generated.


Note that the error line doesn't have a location, and that only one member is
being initialized.  The error goes away if the MyStruct constructor isn't a
template.

-- 
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