diff options
author | Marek Polacek <polacek@redhat.com> | 2019-06-12 20:17:36 +0000 |
---|---|---|
committer | Marek Polacek <mpolacek@gcc.gnu.org> | 2019-06-12 20:17:36 +0000 |
commit | 72b091f736addb1ca458e7766dc4547fde331d28 (patch) | |
tree | 1a662ce024533e68e02e5dace123d03d37c6a861 /gcc/cp | |
parent | 95b3d0fda31a3ce11a84742374bd1ffaad57f6e2 (diff) | |
download | gcc-72b091f736addb1ca458e7766dc4547fde331d28.zip gcc-72b091f736addb1ca458e7766dc4547fde331d28.tar.gz gcc-72b091f736addb1ca458e7766dc4547fde331d28.tar.bz2 |
PR c++/90736 - bogus error with alignof.
* constexpr.c (adjust_temp_type): Use cv_unqualified type.
* g++.dg/cpp0x/alignof5.C: New test.
From-SVN: r272217
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/cp/constexpr.c | 4 |
2 files changed, 8 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 5e8fd69..90a7b2a 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2019-06-12 Marek Polacek <polacek@redhat.com> + + PR c++/90736 - bogus error with alignof. + * constexpr.c (adjust_temp_type): Use cv_unqualified type. + 2019-06-11 Matthew Beliveau <mbelivea@redhat.com> PR c++/90449 - add -Winaccessible-base option. diff --git a/gcc/cp/constexpr.c b/gcc/cp/constexpr.c index a2f2969..60cfafc 100644 --- a/gcc/cp/constexpr.c +++ b/gcc/cp/constexpr.c @@ -1318,7 +1318,9 @@ adjust_temp_type (tree type, tree temp) if (TREE_CODE (temp) == EMPTY_CLASS_EXPR) return build0 (EMPTY_CLASS_EXPR, type); gcc_assert (scalarish_type_p (type)); - return cp_fold_convert (type, temp); + /* Now we know we're dealing with a scalar, and a prvalue of non-class + type is cv-unqualified. */ + return cp_fold_convert (cv_unqualified (type), temp); } /* If T is a CONSTRUCTOR, return an unshared copy of T and any |