https://bugs.llvm.org/show_bug.cgi?id=38043

            Bug ID: 38043
           Summary: Explicit array initialization in an initializer list
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
          Assignee: unassignedclangb...@nondot.org
          Reporter: zahira.ammarguel...@intel.com
                CC: dgre...@apple.com, llvm-bugs@lists.llvm.org

Let's consider this test case:

#include <stdio.h>

struct foo {
  int i;
  foo() : i(23) {}
};

struct goo {
  goo() {}
  goo(const goo & other);
  foo _lala[2];
};

goo::goo(const goo & other)
  : _lala(other._lala)
{
}

int main()
{
  goo z;
  if (z._lala[0].i == 23)
    puts("passed");
  else
    puts("failed");
  return 0;
}

GCC compiles this.
CL and CLANG both generate an error.

Clang's error message is:
error: array initializer must be an initializer list


If the community doesn't want to follow GCC and allow array initialization via
an initializer list (violation of C++), then clang should at least return the
right error message as this is misleading?

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to