[LLVMbugs] [Bug 17694] Rejects-valid: constexpr and explicit default ctor

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Oct 25 11:07:28 PDT 2013


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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |richard-llvm at metafoo.co.uk
         Resolution|---                         |LATER

--- Comment #1 from Richard Smith <richard-llvm at metafoo.co.uk> ---
It's helpful to provide the diagnostic when reporting that code is rejected.
Here, Clang says:

<stdin>:9:15: error: default initialization of an object of const type 'const
A' requires a user-provided default constructor
  constexpr A a;
              ^

... which is correct. g++ accepts this because it has speculatively implemented
a resolution to this core issue:

  http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#253

In Clang, we're waiting for the issue to actually be resolved before we take a
direction on it.


Note that 'constexpr' is entirely irrelevant here; the same thing happens with:

class A
{
public:
  A() = default;
};

int main(int argc, char** argv)
{
  const A a;
}

In either case, g++ also rejects if you add any data member to 'A'.

-- 
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/20131025/0efe7d07/attachment.html>


More information about the llvm-bugs mailing list