re PR c++/70229 (error: constexpr constructor does not have empty body)
PR c++/70229 * constexpr.c (check_constexpr_ctor_body_1): Allow typedef declarations. * g++.dg/cpp0x/constexpr-ctor19.C: New test. From-SVN: r239115
This commit is contained in:
parent
fb46286e8d
commit
a00084346a
@ -1,3 +1,9 @@
|
||||
2016-08-04 Marek Polacek <polacek@redhat.com>
|
||||
|
||||
PR c++/70229
|
||||
* constexpr.c (check_constexpr_ctor_body_1): Allow typedef
|
||||
declarations.
|
||||
|
||||
2016-08-01 Jason Merrill <jason@redhat.com>
|
||||
|
||||
* mangle.c (mangle_decl): Warn about mangled name change even if
|
||||
|
@ -425,7 +425,8 @@ check_constexpr_ctor_body_1 (tree last, tree list)
|
||||
switch (TREE_CODE (list))
|
||||
{
|
||||
case DECL_EXPR:
|
||||
if (TREE_CODE (DECL_EXPR_DECL (list)) == USING_DECL)
|
||||
if (TREE_CODE (DECL_EXPR_DECL (list)) == USING_DECL
|
||||
|| TREE_CODE (DECL_EXPR_DECL (list)) == TYPE_DECL)
|
||||
return true;
|
||||
return false;
|
||||
|
||||
|
@ -1,3 +1,8 @@
|
||||
2016-08-04 Marek Polacek <polacek@redhat.com>
|
||||
|
||||
PR c++/70229
|
||||
* g++.dg/cpp0x/constexpr-ctor19.C: New test.
|
||||
|
||||
2016-08-04 Richard Biener <rguenther@suse.de>
|
||||
|
||||
PR middle-end/71984
|
||||
|
42
gcc/testsuite/g++.dg/cpp0x/constexpr-ctor19.C
Normal file
42
gcc/testsuite/g++.dg/cpp0x/constexpr-ctor19.C
Normal file
@ -0,0 +1,42 @@
|
||||
// PR c++/70229
|
||||
// { dg-do compile { target c++11 } }
|
||||
|
||||
template <class>
|
||||
class S {
|
||||
constexpr S (void) {
|
||||
typedef int T;
|
||||
}
|
||||
};
|
||||
|
||||
template <class>
|
||||
class S2 {
|
||||
constexpr S2 (void) {
|
||||
;
|
||||
}
|
||||
};
|
||||
|
||||
template <class>
|
||||
class S3 {
|
||||
constexpr S3 (void) {
|
||||
typedef enum { X } E;
|
||||
} // { dg-error "does not have empty body" "" { target c++11_only } }
|
||||
};
|
||||
|
||||
template <class>
|
||||
class S4 {
|
||||
constexpr S4 (void) {
|
||||
typedef struct { int j; } U;
|
||||
} // { dg-error "does not have empty body" "" { target c++11_only } }
|
||||
};
|
||||
|
||||
struct V
|
||||
{
|
||||
int i;
|
||||
};
|
||||
|
||||
template <class>
|
||||
class S5 {
|
||||
constexpr S5 (void) {
|
||||
typedef V W;
|
||||
}
|
||||
};
|
Loading…
Reference in New Issue
Block a user