Description of problem: Looks it's the same problem as https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70528. It happens with devtoolset-7-gcc-c++-7.2.1-1 How reproducible: The code ( extacted from https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70528 ) template <class T, class U = decltype(T())> struct I { }; struct J { struct K { int First = 0; }; I<K> FunctionMDInfo; }; Steps to Reproduce: 1. when compiles the above code snippet with "g++ (GCC) 4.8.3 20140911 (Red Hat 4.8.3-9)" from gcc-c++-4.8.3-9.el7.x86_64, the compiling passes. 2. when compiles the above code snippet with "g++ (GCC) 7.2.1 20170829 (Red Hat 7.2.1-1)" from devtoolset-7-gcc-c++-7.2.1-1 . It shows the following error messages. t.cpp:1:39: error: constructor required before non-static data member for ‘J::K::First’ has been parsed template <class T, class U = decltype(T())> ^~~
Additionally, when compiling the code snippet with g++ 4.8.3, need to add the option "std=c++11"
Isn't that invalid though? I mean, trunk g++ rejects the code: 70528.C:1:39: error: default member initializer for ‘J::K::First’ required before the end of its enclosing class template <class T, class U = decltype(T())> ^~~ 70528.C:7:15: note: defined here int First = 0; ^~~~ as does clang++: 70528.C:1:39: error: default member initializer for 'First' needed within definition of enclosing class 'J' outside of member functions template <class T, class U = decltype(T())> ^ 70528.C:9:3: note: in instantiation of default argument for 'I<J::K>' required here I<K> FunctionMDInfo; ^~~~ 70528.C:7:9: note: default member initializer declared here int First = 0; ^ 1 error generated.
The PR has been resolved and the code is rejected (as it should be). Let's move on with this one.
VERIFIED for devtoolset-8-gcc-8.2.1-3. The related tests passed.
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHBA-2018:3562