* constexpr.c (adjust_temp_type): Use cv_unqualified type.
* g++.dg/cpp0x/alignof5.C: New test.
From-SVN: r272219
+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 Jakub Jelinek <jakub@redhat.com>
PR c++/90810
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);
}
/* Callback for walk_tree used by unshare_constructor. */
--- /dev/null
+// 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;