c++: Immediately deduce auto member [PR94926].
authorJason Merrill <jason@redhat.com>
Thu, 28 May 2020 04:35:56 +0000 (00:35 -0400)
committerJason Merrill <jason@redhat.com>
Thu, 28 May 2020 18:58:16 +0000 (14:58 -0400)
commit7b599b9f9a1e036ff75a4daa06ac7036c6ebbe01
tree32f368ca47633fad4cba5936700a702f83585b9b
parentc83027f32d9cca84959c7d6a1e519a0129731501
c++: Immediately deduce auto member [PR94926].

In r9-297 I was trying to be more flexible and treat static data members of
class templates more like variable templates, where the type need not be
determined until the variable is instantiated, but I suppose that in a class
the types of all the non-template members need to be determined at the time
of class instantiation.

gcc/cp/ChangeLog:

PR c++/94926
* decl.c (cp_finish_decl): Revert r9-297 change.
(check_static_variable_definition): Likewise.
* constexpr.c (ensure_literal_type_for_constexpr_object): Likewise.
* pt.c (instantiate_decl): Return early on type error.

gcc/testsuite/ChangeLog:

* g++.dg/cpp1z/pr86648.C: Expect error.
* g++.dg/cpp1z/static2.C: Expect error.
* g++.dg/cpp0x/nsdmi16.C: New test.
gcc/cp/constexpr.c
gcc/cp/decl.c
gcc/cp/pt.c
gcc/testsuite/g++.dg/cpp0x/nsdmi16.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp1z/pr86648.C
gcc/testsuite/g++.dg/cpp1z/static2.C