public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/65080] New: constexpr-ness lost by using alias in definition
@ 2015-02-16 16:06 kaballo86 at hotmail dot com
  2015-02-16 16:28 ` [Bug c++/65080] " ville.voutilainen at gmail dot com
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: kaballo86 at hotmail dot com @ 2015-02-16 16:06 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65080

            Bug ID: 65080
           Summary: constexpr-ness lost by using alias in definition
           Product: gcc
           Version: 4.9.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: kaballo86 at hotmail dot com

In the following snippet, whether the expression `xxx<int>` designates a
constexpr function or not depends on whether `foo<T>::value` is defined with an
alias or not:

    template <typename T>
    static constexpr T xxx(){ return T(); }

    template <typename T>
    struct foo {
      using type = T(*)();
      static constexpr type value[1] = {&xxx<T>};
    };

    template <typename T>
    constexpr typename foo<T>::type foo<T>::value[1]; // fails
    //constexpr T (*foo<T>::value[1])(); // works

    int main() {
      constexpr int x = foo<int>::value[0](); // error here
    }

Both definitions work fine in trunk. I couldn't find a PR for it, so I'm
reporting it anyways to make sure there is a test covering it.


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

* [Bug c++/65080] constexpr-ness lost by using alias in definition
  2015-02-16 16:06 [Bug c++/65080] New: constexpr-ness lost by using alias in definition kaballo86 at hotmail dot com
@ 2015-02-16 16:28 ` ville.voutilainen at gmail dot com
  2015-02-16 17:48 ` paolo at gcc dot gnu.org
  2015-02-16 17:50 ` paolo.carlini at oracle dot com
  2 siblings, 0 replies; 4+ messages in thread
From: ville.voutilainen at gmail dot com @ 2015-02-16 16:28 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65080

Ville Voutilainen <ville.voutilainen at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |rejects-valid
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2015-02-16
                 CC|                            |paolo.carlini at oracle dot com,
                   |                            |ville.voutilainen at gmail dot com
      Known to work|                            |5.0
     Ever confirmed|0                           |1
      Known to fail|                            |4.8.2, 4.9.1

--- Comment #1 from Ville Voutilainen <ville.voutilainen at gmail dot com> ---
This does seem like an added test is enough, unless we already have a test for
it,
of course. :) Paolo, could you please handle this?


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

* [Bug c++/65080] constexpr-ness lost by using alias in definition
  2015-02-16 16:06 [Bug c++/65080] New: constexpr-ness lost by using alias in definition kaballo86 at hotmail dot com
  2015-02-16 16:28 ` [Bug c++/65080] " ville.voutilainen at gmail dot com
@ 2015-02-16 17:48 ` paolo at gcc dot gnu.org
  2015-02-16 17:50 ` paolo.carlini at oracle dot com
  2 siblings, 0 replies; 4+ messages in thread
From: paolo at gcc dot gnu.org @ 2015-02-16 17:48 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65080

--- Comment #2 from paolo at gcc dot gnu.org <paolo at gcc dot gnu.org> ---
Author: paolo
Date: Mon Feb 16 17:48:08 2015
New Revision: 220739

URL: https://gcc.gnu.org/viewcvs?rev=220739&root=gcc&view=rev
Log:
2015-02-16  Paolo Carlini  <paolo.carlini@oracle.com>

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

Added:
    trunk/gcc/testsuite/g++.dg/cpp0x/constexpr-65080.C
Modified:
    trunk/gcc/testsuite/ChangeLog


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

* [Bug c++/65080] constexpr-ness lost by using alias in definition
  2015-02-16 16:06 [Bug c++/65080] New: constexpr-ness lost by using alias in definition kaballo86 at hotmail dot com
  2015-02-16 16:28 ` [Bug c++/65080] " ville.voutilainen at gmail dot com
  2015-02-16 17:48 ` paolo at gcc dot gnu.org
@ 2015-02-16 17:50 ` paolo.carlini at oracle dot com
  2 siblings, 0 replies; 4+ messages in thread
From: paolo.carlini at oracle dot com @ 2015-02-16 17:50 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65080

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|paolo.carlini at oracle dot com    |
         Resolution|---                         |FIXED
   Target Milestone|---                         |5.0

--- Comment #3 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Done. Thanks Ville.


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

end of thread, other threads:[~2015-02-16 17:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-16 16:06 [Bug c++/65080] New: constexpr-ness lost by using alias in definition kaballo86 at hotmail dot com
2015-02-16 16:28 ` [Bug c++/65080] " ville.voutilainen at gmail dot com
2015-02-16 17:48 ` paolo at gcc dot gnu.org
2015-02-16 17:50 ` paolo.carlini at oracle dot com

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