mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-02-23 09:49:31 +08:00
re PR c++/55003 ([C++11] Member function pointer not working as constexpr initializer)
PR c++/55003 * decl.c (cp_finish_decl): Force instantiation of an auto static data member. From-SVN: r196069
This commit is contained in:
parent
d132b74aba
commit
b24cd3d1f8
@ -1,5 +1,9 @@
|
||||
2013-02-14 Jason Merrill <jason@redhat.com>
|
||||
|
||||
PR c++/55003
|
||||
* decl.c (cp_finish_decl): Force instantiation of an
|
||||
auto static data member.
|
||||
|
||||
PR c++/55220
|
||||
* pt.c (unify): A pack expansion that is not the last template
|
||||
argument makes the entire template argument list non-deduced.
|
||||
|
@ -6111,6 +6111,15 @@ cp_finish_decl (tree decl, tree init, bool init_const_expr_p,
|
||||
tree d_init;
|
||||
if (init == NULL_TREE)
|
||||
{
|
||||
if (DECL_TEMPLATE_INSTANTIATION (decl)
|
||||
&& !DECL_TEMPLATE_INSTANTIATED (decl))
|
||||
{
|
||||
/* init is null because we're deferring instantiating the
|
||||
initializer until we need it. Well, we need it now. */
|
||||
instantiate_decl (decl, /*defer_ok*/true, /*expl*/false);
|
||||
return;
|
||||
}
|
||||
|
||||
error ("declaration of %q#D has no initializer", decl);
|
||||
TREE_TYPE (decl) = error_mark_node;
|
||||
return;
|
||||
|
14
gcc/testsuite/g++.dg/cpp0x/auto37.C
Normal file
14
gcc/testsuite/g++.dg/cpp0x/auto37.C
Normal file
@ -0,0 +1,14 @@
|
||||
// PR c++/55003
|
||||
// { dg-do compile { target c++11 } }
|
||||
|
||||
template<typename T>
|
||||
struct A {
|
||||
static const auto t
|
||||
= (typename T::type)42;
|
||||
};
|
||||
|
||||
struct X {
|
||||
typedef int type;
|
||||
};
|
||||
|
||||
A<X> a;
|
Loading…
Reference in New Issue
Block a user