public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "bkoz at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/46134] New: constexpr vs. defaulted ctor
Date: Fri, 22 Oct 2010 15:30:00 -0000	[thread overview]
Message-ID: <bug-46134-4@http.gcc.gnu.org/bugzilla/> (raw)

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46134

           Summary: constexpr vs. defaulted ctor
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: bkoz@gcc.gnu.org


Changing std::chrono::duration's default constructor to "default" from an empty
body causes a new error.

Ie:

diff --git a/libstdc++-v3/include/std/chrono b/libstdc++-v3/include/std/chrono
index bbcb0ff..d346049 100644
--- a/libstdc++-v3/include/std/chrono
+++ b/libstdc++-v3/include/std/chrono
@@ -209,7 +209,7 @@ namespace std
        static_assert(_Period::num > 0, "period must be positive");

        // 20.8.3.1 construction / copy / destroy
-       constexpr duration() { }
+       constexpr duration() = default;

        template<typename _Rep2, typename = typename
               enable_if<is_convertible<_Rep2, rep>::value


See attached pre-processed file for simple reproducer. Error message is:

In file included from
/mnt/share/src/gcc.git-constexpr/libstdc++-v3/testsuite/20_util/duration/cons/constexpr.cc:22:0:
/mnt/share/src/gcc.git-constexpr/libstdc++-v3/testsuite/util/testsuite_common_types.h:
In member function ‘void
__gnu_test::constexpr_default_constructible::operator()()::_Concept::__constraint()
[with _Tp = std::chrono::duration<long int>]’:
/mnt/share/src/gcc.git-constexpr/libstdc++-v3/testsuite/util/testsuite_common_types.h:629:17:
  instantiated from ‘void
__gnu_test::constexpr_default_constructible::operator()() [with _Tp =
std::chrono::duration<long int>]’
/mnt/share/src/gcc.git-constexpr/libstdc++-v3/testsuite/20_util/duration/cons/constexpr.cc:27:48:
  instantiated from here
/mnt/share/src/gcc.git-constexpr/libstdc++-v3/testsuite/util/testsuite_common_types.h:625:20:
error: uninitialized const ‘__v’ [-fpermissive]
/mnt/share/bld/gcc.git-constexpr/x86_64-unknown-linux-gnu/libstdc++-v3/include/chrono:201:14:
note: ‘const struct std::chrono::duration<long int>’ has no user-provided
default constructor
/mnt/share/bld/gcc.git-constexpr/x86_64-unknown-linux-gnu/libstdc++-v3/include/chrono:212:12:
note: constructor is not user-provided because it is explicitly defaulted in
the class body


             reply	other threads:[~2010-10-22 15:30 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-22 15:30 bkoz at gcc dot gnu.org [this message]
2010-10-22 15:31 ` [Bug c++/46134] " bkoz at gcc dot gnu.org
2010-10-22 18:47 ` jason at gcc dot gnu.org
2010-11-02  2:36 ` jason at gcc dot gnu.org
2010-11-02  9:48 ` redi at gcc dot gnu.org
2010-11-02  9:58 ` redi at gcc dot gnu.org
2010-11-02 12:33 ` redi at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-46134-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).