public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/46134] New: constexpr vs. defaulted ctor
@ 2010-10-22 15:30 bkoz at gcc dot gnu.org
  2010-10-22 15:31 ` [Bug c++/46134] " bkoz at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: bkoz at gcc dot gnu.org @ 2010-10-22 15:30 UTC (permalink / raw)
  To: gcc-bugs

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


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2010-11-02 12:33 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-10-22 15:30 [Bug c++/46134] New: constexpr vs. defaulted ctor bkoz at gcc dot gnu.org
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

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).