public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/51305] New: [C++11][constexpr] noexcept-specifier overconstraints constexpr functions
@ 2011-11-25 17:45 daniel.kruegler at googlemail dot com
  2011-11-25 20:19 ` [Bug c++/51305] " paolo.carlini at oracle dot com
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: daniel.kruegler at googlemail dot com @ 2011-11-25 17:45 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 51305
           Summary: [C++11][constexpr] noexcept-specifier overconstraints
                    constexpr functions
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: daniel.kruegler@googlemail.com
                CC: jason@gcc.gnu.org


gcc 4.7.0 20111119 (experimental) in C++11 mode with -Wall rejects the
following code:

//-------
constexpr bool ok() noexcept
{
  typedef int type;
  return true;
}

constexpr auto x = ok();
//-------

the error being:

"
main.cpp||In function 'constexpr bool ok()':|
main.cpp|5|error: body of constexpr function 'constexpr bool ok()' not a
return-statement|
main.cpp|7|error: 'constexpr bool ok()' called in a constant expression
"

The stringency becomes activated with the addition of the noexcept-specifier to
the constexpr function.

Here is a more advanced test set that should be accepted after the fix of this
issue:

//-------
namespace n { void foo(); }

constexpr bool ok() noexcept
{
  typedef bool some;
  using other = int;
  using namespace n;
  using n::foo;
  ;
  static_assert(!false, "");
  return true;
}

constexpr auto x = ok();

template<bool>
struct C{};

C<ok()> c;
//-------


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

* [Bug c++/51305] [C++11][constexpr] noexcept-specifier overconstraints constexpr functions
  2011-11-25 17:45 [Bug c++/51305] New: [C++11][constexpr] noexcept-specifier overconstraints constexpr functions daniel.kruegler at googlemail dot com
@ 2011-11-25 20:19 ` paolo.carlini at oracle dot com
  2011-12-21  1:23 ` paolo.carlini at oracle dot com
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: paolo.carlini at oracle dot com @ 2011-11-25 20:19 UTC (permalink / raw)
  To: gcc-bugs

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

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2011-11-25
     Ever Confirmed|0                           |1

--- Comment #1 from Paolo Carlini <paolo.carlini at oracle dot com> 2011-11-25 19:24:12 UTC ---
Doh! At some point I also notices something very weird going on with typedefs
but didn't pay enough attention to it.


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

* [Bug c++/51305] [C++11][constexpr] noexcept-specifier overconstraints constexpr functions
  2011-11-25 17:45 [Bug c++/51305] New: [C++11][constexpr] noexcept-specifier overconstraints constexpr functions daniel.kruegler at googlemail dot com
  2011-11-25 20:19 ` [Bug c++/51305] " paolo.carlini at oracle dot com
@ 2011-12-21  1:23 ` paolo.carlini at oracle dot com
  2011-12-21 16:30 ` paolo.carlini at oracle dot com
  2011-12-21 16:38 ` paolo at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: paolo.carlini at oracle dot com @ 2011-12-21  1:23 UTC (permalink / raw)
  To: gcc-bugs

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

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
         AssignedTo|unassigned at gcc dot       |paolo.carlini at oracle dot
                   |gnu.org                     |com
   Target Milestone|---                         |4.7.0

--- Comment #2 from Paolo Carlini <paolo.carlini at oracle dot com> 2011-12-21 01:14:51 UTC ---
On it.


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

* [Bug c++/51305] [C++11][constexpr] noexcept-specifier overconstraints constexpr functions
  2011-11-25 17:45 [Bug c++/51305] New: [C++11][constexpr] noexcept-specifier overconstraints constexpr functions daniel.kruegler at googlemail dot com
  2011-11-25 20:19 ` [Bug c++/51305] " paolo.carlini at oracle dot com
  2011-12-21  1:23 ` paolo.carlini at oracle dot com
@ 2011-12-21 16:30 ` paolo.carlini at oracle dot com
  2011-12-21 16:38 ` paolo at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: paolo.carlini at oracle dot com @ 2011-12-21 16:30 UTC (permalink / raw)
  To: gcc-bugs

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

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED

--- Comment #4 from Paolo Carlini <paolo.carlini at oracle dot com> 2011-12-21 16:29:20 UTC ---
Fixed.


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

* [Bug c++/51305] [C++11][constexpr] noexcept-specifier overconstraints constexpr functions
  2011-11-25 17:45 [Bug c++/51305] New: [C++11][constexpr] noexcept-specifier overconstraints constexpr functions daniel.kruegler at googlemail dot com
                   ` (2 preceding siblings ...)
  2011-12-21 16:30 ` paolo.carlini at oracle dot com
@ 2011-12-21 16:38 ` paolo at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: paolo at gcc dot gnu.org @ 2011-12-21 16:38 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from paolo at gcc dot gnu.org <paolo at gcc dot gnu.org> 2011-12-21 16:28:19 UTC ---
Author: paolo
Date: Wed Dec 21 16:28:08 2011
New Revision: 182594

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=182594
Log:
/cp
2011-12-21  Paolo Carlini  <paolo.carlini@oracle.com>

    PR c++/51305
    * semantics.c (massage_constexpr_body): Reorder conditionals, make
    sure a BIND_EXPR embedded in a MUST_NOT_THROW_EXPR is handled.

/testsuite
2011-12-21  Paolo Carlini  <paolo.carlini@oracle.com>

    PR c++/51305
    * g++.dg/cpp0x/constexpr-noexcept6.C: New.

Added:
    trunk/gcc/testsuite/g++.dg/cpp0x/constexpr-noexcept6.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/semantics.c
    trunk/gcc/testsuite/ChangeLog


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

end of thread, other threads:[~2011-12-21 16:30 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-11-25 17:45 [Bug c++/51305] New: [C++11][constexpr] noexcept-specifier overconstraints constexpr functions daniel.kruegler at googlemail dot com
2011-11-25 20:19 ` [Bug c++/51305] " paolo.carlini at oracle dot com
2011-12-21  1:23 ` paolo.carlini at oracle dot com
2011-12-21 16:30 ` paolo.carlini at oracle dot com
2011-12-21 16:38 ` paolo 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).