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
This commit is contained in:
Marek Polacek 2019-06-12 20:17:36 +00:00 committed by Marek Polacek
parent 95b3d0fda3
commit 72b091f736
4 changed files with 19 additions and 1 deletions

View File

@ -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.

View File

@ -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

View File

@ -1,3 +1,8 @@
2019-06-12 Marek Polacek <polacek@redhat.com>
PR c++/90736 - bogus error with alignof.
* g++.dg/cpp0x/alignof5.C: New test.
2019-06-12 Dimitar Dimitrov <dimitar@dinux.eu>
* gcc.dg/builtin-apply2.c: Skip for PRU.

View File

@ -0,0 +1,6 @@
// PR c++/90736 - bogus error with alignof.
// { dg-do compile { target c++11 } }
constexpr int fn(const int b) { return b; }
constexpr int c = fn(alignof(int));
alignas(c) char d;