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

Javier V. Gómez <jota.uve at hotmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jota.uve at hotmail dot com

--- Comment #2 from Javier V. Gómez <jota.uve at hotmail dot com> ---
I found another case that worked in G++ 4.8.3 but fails in 4.9:

---------
main.cpp: 
---------
int main ()
{
    constexpr int n = 2;
    A<n> a;
    B b;
    b.foo();
}

---------
a.hpp: 
---------
template <size_t n> class A
{
    static constexpr size_t getN() {return n;}
};

---------
b.hpp: 
---------
class B 
{
    void foo ()
    {
        //has access to a A<n> object
        constexpr int n = a.getN();
        A<n> a2;
    }
};


Compiler output:
B.hpp: error: the value of ‘n’ is not usable in a constant expression
             A<n> a2;
               ^
B.hpp: note: ‘ndims’ used in its own initializer
             constexpr int n = a.getN();
                           ^

Reply via email to