[llvm-bugs] [Bug 42336] the check of static array initializer is strange

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Jun 20 10:12:45 PDT 2019


Richard Smith <richard-llvm at metafoo.co.uk> changed:

           What    |Removed                     |Added
         Resolution|---                         |INVALID
             Status|NEW                         |RESOLVED

--- Comment #1 from Richard Smith <richard-llvm at metafoo.co.uk> ---
[First case]
> clang accepts the code, but gcc reject it:

GCC's diagnostic is wrong here. The problem is that only a constexpr or const
integral data member can be initialized in a class definition. It looks like
GCC correctly detects the problem but then issues the wrong diagnostic in this

It looks like clang doesn't diagnose that problem until the class is
instantiated if the initializer of the member is type-dependent (but it does
diagnose it in that case). Both Clang's and GCC's behaviors are conforming --
there is no requirement to diagnose invalid templates that are never

[Second case]
> gcc accepts it, but clang rejects it:

This is ill-formed. In this case, Clang rejects it in the template definition,
but GCC doesn't reject it until instantiation. Again, both behaviors are

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/20190620/58165757/attachment.html>

More information about the llvm-bugs mailing list