diff options
author | Jason Merrill <jason@gcc.gnu.org> | 2017-01-10 17:33:09 -0500 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2017-01-10 17:33:09 -0500 |
commit | 8cef58751ad6ddd0d84545cb509395c7b5216445 (patch) | |
tree | eb9d323a72d57ec46a21ea6a7584816b88eed760 /gcc | |
parent | 5a50f6bbedd904cd2d913f4d39646b3d99ed7ca4 (diff) | |
download | gcc-8cef58751ad6ddd0d84545cb509395c7b5216445.zip gcc-8cef58751ad6ddd0d84545cb509395c7b5216445.tar.gz gcc-8cef58751ad6ddd0d84545cb509395c7b5216445.tar.bz2 |
re PR c++/77598 (constexpr compilation failure on reference type casting)
PR c++/77598
* g++.dg/cpp0x/constexpr-ref11.C: New.
From-SVN: r244296
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/testsuite/g++.dg/cpp0x/constexpr-ref11.C | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-ref11.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-ref11.C new file mode 100644 index 0000000..78ea77e --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-ref11.C @@ -0,0 +1,26 @@ +// PR c++/77598 +// { dg-do compile { target c++11 } } + +template <typename T> +struct A { static constexpr T a = T (); }; +template <typename T> +constexpr T A<T>::a; +struct B +{ + int b; + constexpr int foo () const { return b; } + constexpr B (const int &x) : b(x) {}; +}; +struct C : public B +{ + constexpr C () : B(50) {}; +}; +struct D : public C +{ +}; +struct E +{ + static constexpr const auto &e = A<D>::a; +}; +constexpr const B &f = E::e; +constexpr const int g = f.foo (); |