[LLVMbugs] [Bug 20346] New: Strang diagnostic on struct initializer in template

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Jul 17 14:24:19 PDT 2014


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

            Bug ID: 20346
           Summary: Strang diagnostic on struct initializer in template
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: nicolasweber at gmx.de
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

struct S { short inner_s; };

struct outer_struct {
  wchar_t arr[32];
  S outer_s;
};

template <class T>
void OpenFileSession() {
  outer_struct asdfasdf = {};
};

void foo() {
  OpenFileSession<int>();
}


$ ~/src/llvm-build/bin/clang -c test.cc
error: cannot initialize an array element of type 'wchar_t' with an rvalue of
type 'wchar_t [32]'
test.cc:14:3: note: in instantiation of function template specialization
'OpenFileSession<int>' requested here
  OpenFileSession<int>();
  ^

Note: No source location on the error. And gcc and msvc compile this code fine.
(At least the missing source loc should be fixed for sure.)

-- 
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/20140717/2b93fc52/attachment.html>


More information about the llvm-bugs mailing list