Index: cp/init.c =================================================================== --- cp/init.c (revision 210459) +++ cp/init.c (working copy) @@ -644,7 +644,9 @@ perform_member_init (tree member, tree init) || (TREE_CODE (init) == TREE_LIST && DIRECT_LIST_INIT_P (TREE_VALUE (init)))) && (CP_AGGREGATE_TYPE_P (type) - || is_std_init_list (type))))) + || is_std_init_list (type))) + /* This can happen for NSDMI in template class (c++/58930). */ + || DIRECT_LIST_INIT_P (init))) { /* With references and list-initialization, we need to deal with extending temporary lifetimes. 12.2p5: "A temporary bound to a Index: testsuite/g++.dg/cpp0x/nsdmi-template11.C =================================================================== --- testsuite/g++.dg/cpp0x/nsdmi-template11.C (revision 0) +++ testsuite/g++.dg/cpp0x/nsdmi-template11.C (working copy) @@ -0,0 +1,15 @@ +// PR c++/58930 +// { dg-do compile { target c++11 } } + +struct SampleModule +{ + explicit SampleModule (int); +}; + +template < typename > +struct BaseHandler +{ + SampleModule module_ { 0 }; +}; + +BaseHandler a; Index: testsuite/g++.dg/cpp0x/nsdmi-template12.C =================================================================== --- testsuite/g++.dg/cpp0x/nsdmi-template12.C (revision 0) +++ testsuite/g++.dg/cpp0x/nsdmi-template12.C (working copy) @@ -0,0 +1,17 @@ +// PR c++/58753 +// { dg-do compile { target c++11 } } + +#include + +template +struct X {X(std::initializer_list) {}}; + +template +class T { + X x{1}; +}; + +int main() +{ + T t; +}