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.

Reply via email to