/* Fall through */
case ALIGNOF_EXPR:
- pp_cxx_ws_string (this, code == SIZEOF_EXPR ? "sizeof" : "__alignof__");
+ if (code == SIZEOF_EXPR)
+ pp_cxx_ws_string (this, "sizeof");
+ else if (ALIGNOF_EXPR_STD_P (t))
+ pp_cxx_ws_string (this, "alignof");
+ else
+ pp_cxx_ws_string (this, "__alignof__");
pp_cxx_whitespace (this);
if (TREE_CODE (t) == SIZEOF_EXPR && SIZEOF_EXPR_TYPE_P (t))
{
case ALIGNOF_EXPR:
if (TREE_CODE (t) == SIZEOF_EXPR)
pp_cxx_ws_string (pp, "sizeof");
+ else if (ALIGNOF_EXPR_STD_P (t))
+ pp_cxx_ws_string (pp, "alignof");
else
- {
- gcc_assert (TREE_CODE (t) == ALIGNOF_EXPR);
- pp_cxx_ws_string (pp, "__alignof__");
- }
+ pp_cxx_ws_string (pp, "__alignof__");
op = TREE_OPERAND (t, 0);
if (PACK_EXPANSION_P (op))
{
--- /dev/null
+// PR c++/85979
+// { dg-do compile { target c++11 } }
+
+template<int N> struct A { };
+
+template<class T>
+void f(A<alignof(T)>) { }
+
+#if __cpp_concepts
+template<class T>
+void g() requires (alignof(T) == 0);
+#endif
+
+int main() {
+ f<int>(); // { dg-error "no match" }
+#if __cpp_concepts
+ g<int>(); // { dg-error "no match" "" { target c++20 } }
+#endif
+}
+
+// { dg-bogus "__alignof__" "" { target *-*-* } 0 }