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

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