aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/decl.c
diff options
context:
space:
mode:
authorPatrick Palka <ppalka@redhat.com>2021-09-15 13:54:53 -0400
committerPatrick Palka <ppalka@redhat.com>2021-09-15 13:54:53 -0400
commit2ab5c3d5457f0d480c6423ee7ac52ce1f98592c9 (patch)
treed2875d738cd3ed3fa5dc448e369ebecb23a23103 /gcc/cp/decl.c
parent2709337c1181510e3d4f74e86bf75aa83f7b18aa (diff)
downloadgcc-2ab5c3d5457f0d480c6423ee7ac52ce1f98592c9.zip
gcc-2ab5c3d5457f0d480c6423ee7ac52ce1f98592c9.tar.gz
gcc-2ab5c3d5457f0d480c6423ee7ac52ce1f98592c9.tar.bz2
c++: default ctor that's also a list ctor [PR102050]
In grok_special_member_properties we need to set TYPE_HAS_COPY_CTOR, TYPE_HAS_DEFAULT_CONSTRUCTOR and TYPE_HAS_LIST_CTOR independently from each other because a constructor can be both a default and list constructor (as in the first testcase), or both a default and copy constructor (as in the second testcase). PR c++/102050 gcc/cp/ChangeLog: * decl.c (grok_special_member_properties): Set TYPE_HAS_COPY_CTOR, TYPE_HAS_DEFAULT_CONSTRUCTOR and TYPE_HAS_LIST_CTOR independently from each other. gcc/testsuite/ChangeLog: * g++.dg/cpp0x/initlist125.C: New test. * g++.dg/cpp0x/initlist126.C: New test.
Diffstat (limited to 'gcc/cp/decl.c')
-rw-r--r--gcc/cp/decl.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 9ad9446..c0f1496 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -14847,9 +14847,11 @@ grok_special_member_properties (tree decl)
if (ctor > 1)
TYPE_HAS_CONST_COPY_CTOR (class_type) = 1;
}
- else if (sufficient_parms_p (FUNCTION_FIRST_USER_PARMTYPE (decl)))
+
+ if (sufficient_parms_p (FUNCTION_FIRST_USER_PARMTYPE (decl)))
TYPE_HAS_DEFAULT_CONSTRUCTOR (class_type) = 1;
- else if (is_list_ctor (decl))
+
+ if (is_list_ctor (decl))
TYPE_HAS_LIST_CTOR (class_type) = 1;
if (DECL_DECLARED_CONSTEXPR_P (decl)