diff --git a/gcc/c-family/c-attribs.cc b/gcc/c-family/c-attribs.cc
index e2792ca6898b35bd5753ea3288e9ec433d314dc8..e0c4259c905ed5e6f55cf4f0fa19bbbcc879879d 100644
--- a/gcc/c-family/c-attribs.cc
+++ b/gcc/c-family/c-attribs.cc
@@ -4366,7 +4366,8 @@ type_valid_for_vector_size (tree type, tree atname, tree args,
 	  && GET_MODE_CLASS (orig_mode) != MODE_INT
 	  && !ALL_SCALAR_FIXED_POINT_MODE_P (orig_mode))
       || !tree_fits_uhwi_p (TYPE_SIZE_UNIT (type))
-      || TREE_CODE (type) == BOOLEAN_TYPE)
+      || TREE_CODE (type) == BOOLEAN_TYPE
+      || TREE_CODE (type) == BITINT_TYPE)
     {
       if (error_p)
 	error ("invalid vector type for attribute %qE", atname);
diff --git a/gcc/c/c-decl.cc b/gcc/c/c-decl.cc
index c9dd135d9230184f1cb6bbb50a5c30e03d76bbfb..649c5ae66c281fb1ce80ddaacdd6309d401392c2 100644
--- a/gcc/c/c-decl.cc
+++ b/gcc/c/c-decl.cc
@@ -12934,8 +12934,15 @@ finish_declspecs (struct c_declspecs *specs)
       if (specs->u.bitint_prec == -1)
 	specs->type = integer_type_node;
       else
-	specs->type = build_bitint_type (specs->u.bitint_prec,
-					 specs->unsigned_p);
+	{
+	  pedwarn_c11 (specs->locations[cdw_typespec], OPT_Wpedantic,
+		       "ISO C does not support %<%s_BitInt(%d)%> before C2X",
+		       specs->unsigned_p ? "unsigned "
+		       : specs->signed_p ? "signed " : "",
+		       specs->u.bitint_prec);
+	  specs->type = build_bitint_type (specs->u.bitint_prec,
+					   specs->unsigned_p);
+	}
       break;
     default:
       gcc_unreachable ();
diff --git a/gcc/c/c-typeck.cc b/gcc/c/c-typeck.cc
index 5bb9f83ab8695768f4efc18dd37e645aa04f7c1b..e2bfd2caf8569272fb77204e97eeb351eb7c0833 100644
--- a/gcc/c/c-typeck.cc
+++ b/gcc/c/c-typeck.cc
@@ -817,6 +817,12 @@ c_common_type (tree t1, tree t2)
 	return t1;
       else if (code2 == COMPLEX_TYPE && TREE_TYPE (t2) == subtype)
 	return t2;
+      else if (TREE_CODE (subtype) == BITINT_TYPE)
+	{
+	  sorry ("%<_Complex _BitInt(%d)%> unsupported",
+		 TYPE_PRECISION (subtype));
+	  return code1 == COMPLEX_TYPE ? t1 : t2;
+	}
       else
 	return build_complex_type (subtype);
     }
diff --git a/gcc/testsuite/g++.dg/ext/bitint1.C b/gcc/testsuite/g++.dg/ext/bitint1.C
new file mode 100644
index 0000000000000000000000000000000000000000..3d9afdcd395f6ff4e1a21c3cf744722ee9e90c7a
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/bitint1.C
@@ -0,0 +1,9 @@
+// PR c/102989
+// { dg-do compile }
+
+_BitInt(63) a;			// { dg-error "expected" }
+unsigned _BitInt(31) b;		// { dg-error "expected" }
+int c = 21wb;			// { dg-error "invalid suffix \"wb\" on integer constant" "" { target c++98_only } }
+				// { dg-error "unable to find numeric literal operator 'operator\"\"wb'" "" { target c++11 } .-1 }
+long long d = 60594869054uwb;	// { dg-error "invalid suffix \"uwb\" on integer constant" "" { target c++98_only } }
+				// { dg-error "unable to find numeric literal operator 'operator\"\"uwb'" "" { target c++11 } .-1 }
diff --git a/gcc/testsuite/g++.dg/ext/bitint2.C b/gcc/testsuite/g++.dg/ext/bitint2.C
new file mode 100644
index 0000000000000000000000000000000000000000..ae8b9cbd0f46988a27b832e9dd4c4f21677bfe4c
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/bitint2.C
@@ -0,0 +1,10 @@
+// PR c/102989
+// { dg-do compile }
+// { dg-options "" }
+
+_BitInt(63) a;			// { dg-error "expected" }
+unsigned _BitInt(31) b;		// { dg-error "expected" }
+int c = 21wb;			// { dg-error "invalid suffix \"wb\" on integer constant" "" { target c++98_only } }
+				// { dg-error "unable to find numeric literal operator 'operator\"\"wb'" "" { target c++11 } .-1 }
+long long d = 60594869054uwb;	// { dg-error "invalid suffix \"uwb\" on integer constant" "" { target c++98_only } }
+				// { dg-error "unable to find numeric literal operator 'operator\"\"uwb'" "" { target c++11 } .-1 }
diff --git a/gcc/testsuite/g++.dg/ext/bitint3.C b/gcc/testsuite/g++.dg/ext/bitint3.C
new file mode 100644
index 0000000000000000000000000000000000000000..8918a7f77cd9fe13a171a553171a993406fd5200
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/bitint3.C
@@ -0,0 +1,8 @@
+// PR c/102989
+// { dg-do compile { target c++11 } }
+
+constexpr int operator""wb (unsigned long long) { return 0; }	// { dg-warning "reserved for future standardization" }
+constexpr int operator""uwb (unsigned long long) { return 1; }	// { dg-warning "reserved for future standardization" }
+
+static_assert (-42wb == 0, "");
+static_assert (81uwb == 1, "");
diff --git a/gcc/testsuite/g++.dg/ext/bitint4.C b/gcc/testsuite/g++.dg/ext/bitint4.C
new file mode 100644
index 0000000000000000000000000000000000000000..32e1ac5ac48fa839c08b945b4aad95e852876173
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/bitint4.C
@@ -0,0 +1,9 @@
+// PR c/102989
+// { dg-do compile { target c++11 } }
+// { dg-options "" }
+
+constexpr int operator""wb (unsigned long long) { return 0; }	// { dg-warning "reserved for future standardization" }
+constexpr int operator""uwb (unsigned long long) { return 1; }	// { dg-warning "reserved for future standardization" }
+
+static_assert (-42wb == 0, "");
+static_assert (81uwb == 1, "");
diff --git a/gcc/testsuite/gcc.dg/bitint-19.c b/gcc/testsuite/gcc.dg/bitint-19.c
new file mode 100644
index 0000000000000000000000000000000000000000..f33a82c3b391c61c1cecd697bb3fe82590707c66
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/bitint-19.c
@@ -0,0 +1,16 @@
+/* PR c/102989 */
+/* { dg-do compile { target bitint } } */
+/* { dg-options "-std=gnu2x" } */
+
+#define expr_has_type(e, t) _Generic (e, default : 0, t : 1)
+
+void
+foo (_Complex int ci, _Complex long long cl)
+{
+  _BitInt(__SIZEOF_INT__ * __CHAR_BIT__ - 1) bi = 0wb;
+  _BitInt(__SIZEOF_LONG_LONG__ * __CHAR_BIT__ - 1) bl = 0wb;
+  static_assert (expr_has_type (ci + bi, _Complex int));
+  static_assert (expr_has_type (cl + bl, _Complex long long));
+  static_assert (expr_has_type (bi + ci, _Complex int));
+  static_assert (expr_has_type (bl + cl, _Complex long long));
+}
diff --git a/gcc/testsuite/gcc.dg/bitint-20.c b/gcc/testsuite/gcc.dg/bitint-20.c
new file mode 100644
index 0000000000000000000000000000000000000000..6b92b5b7ddaeaee23eb952fa904c230336f04d16
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/bitint-20.c
@@ -0,0 +1,16 @@
+/* PR c/102989 */
+/* { dg-do compile { target bitint } } */
+/* { dg-options "-std=gnu2x" } */
+
+void
+foo (_Complex int ci, _Complex long long cl)
+{
+  _BitInt(__SIZEOF_INT__ * __CHAR_BIT__ + 1) bi = 0wb;
+  ci + bi;			/* { dg-message "unsupported" } */
+  bi + ci;			/* { dg-message "unsupported" } */
+#if __BITINT_MAXWIDTH__ >= 575
+  _BitInt(575) bw = 0wb;
+  cl + bw;			/* { dg-message "unsupported" "" { target bitint575 } } */
+  bw + cl;			/* { dg-message "unsupported" "" { target bitint575 } } */
+#endif
+}
diff --git a/gcc/testsuite/gcc.dg/bitint-21.c b/gcc/testsuite/gcc.dg/bitint-21.c
new file mode 100644
index 0000000000000000000000000000000000000000..72f68c95a29a7baca5a5af5968b637881d75c964
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/bitint-21.c
@@ -0,0 +1,11 @@
+/* PR c/102989 */
+/* { dg-do compile { target bitint } } */
+/* { dg-options "-std=gnu2x" } */
+
+#define IB __SIZEOF_INT__ * __CHAR_BIT__
+typedef _BitInt(IB) V1 __attribute__((vector_size (sizeof (_BitInt(IB)))));		/* { dg-error "invalid vector type for attribute 'vector_size'" } */
+typedef _BitInt(IB) V2 __attribute__((vector_size (8 * sizeof (_BitInt(IB)))));		/* { dg-error "invalid vector type for attribute 'vector_size'" } */
+#if __BITINT_MAXWIDTH__ >= 575
+typedef _BitInt(575) V3 __attribute__((vector_size (sizeof (_BitInt(575)))));		/* { dg-error "invalid vector type for attribute 'vector_size'" "" { target bitint575 } } */
+typedef _BitInt(575) V3 __attribute__((vector_size (16 * sizeof (_BitInt(575)))));	/* { dg-error "invalid vector type for attribute 'vector_size'" "" { target bitint575 } } */
+#endif
diff --git a/gcc/testsuite/gcc.dg/bitint-22.c b/gcc/testsuite/gcc.dg/bitint-22.c
new file mode 100644
index 0000000000000000000000000000000000000000..329d8a885d8fa3923952994715701ec1cfb0f10e
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/bitint-22.c
@@ -0,0 +1,18 @@
+// PR c/102989
+// { dg-do compile { target bitint } }
+// { dg-options "-std=c2x -pedantic-errors" }
+
+_BitInt(63) a;
+signed _BitInt(15) b;
+unsigned _BitInt(31) c;
+int d = 21wb;
+long long e = 60594869054uwb;
+__extension__ _BitInt(63) f;
+__extension__ _BitInt(15) g;
+__extension__ unsigned _BitInt(31) h;
+int i = __extension__ 21wb;
+long long j = __extension__ 60594869054uwb;
+#if 0wb == 0
+#endif
+#if 0uwb == 0
+#endif
diff --git a/gcc/testsuite/gcc.dg/bitint-23.c b/gcc/testsuite/gcc.dg/bitint-23.c
new file mode 100644
index 0000000000000000000000000000000000000000..89041c0f7aedb6268bbd3ec6bc169d3215b0dd93
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/bitint-23.c
@@ -0,0 +1,18 @@
+// PR c/102989
+// { dg-do compile { target bitint } }
+// { dg-options "-std=c2x -pedantic-errors -Wc11-c2x-compat" }
+
+_BitInt(63) a;					/* { dg-warning "ISO C does not support '_BitInt\\\(63\\\)' before C2X" } */
+signed _BitInt(15) b;				/* { dg-warning "ISO C does not support 'signed _BitInt\\\(15\\\)' before C2X" } */
+unsigned _BitInt(31) c;				/* { dg-warning "ISO C does not support 'unsigned _BitInt\\\(31\\\)' before C2X" } */
+int d = 21wb;					/* { dg-warning "ISO C does not support literal 'wb' suffixes before C2X" } */
+long long e = 60594869054uwb;			/* { dg-warning "ISO C does not support literal 'wb' suffixes before C2X" } */
+__extension__ _BitInt(63) f;
+__extension__ _BitInt(15) g;
+__extension__ unsigned _BitInt(31) h;
+int i = __extension__ 21wb;
+long long j = __extension__ 60594869054uwb;
+#if 0wb == 0					/* { dg-warning "ISO C does not support literal 'wb' suffixes before C2X" } */
+#endif
+#if 0uwb == 0					/* { dg-warning "ISO C does not support literal 'wb' suffixes before C2X" } */
+#endif
diff --git a/gcc/testsuite/gcc.dg/bitint-24.c b/gcc/testsuite/gcc.dg/bitint-24.c
new file mode 100644
index 0000000000000000000000000000000000000000..321b5522e73637b0ce1ad0c8f524ad53a9f7758b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/bitint-24.c
@@ -0,0 +1,18 @@
+// PR c/102989
+// { dg-do compile { target bitint } }
+// { dg-options "-std=c11" }
+
+_BitInt(63) a;
+signed _BitInt(15) b;
+unsigned _BitInt(31) c;
+int d = 21wb;
+long long e = 60594869054uwb;
+__extension__ _BitInt(63) f;
+__extension__ _BitInt(15) g;
+__extension__ unsigned _BitInt(31) h;
+int i = __extension__ 21wb;
+long long j = __extension__ 60594869054uwb;
+#if 0wb == 0
+#endif
+#if 0uwb == 0
+#endif
diff --git a/gcc/testsuite/gcc.dg/bitint-25.c b/gcc/testsuite/gcc.dg/bitint-25.c
new file mode 100644
index 0000000000000000000000000000000000000000..b18244f3459c790b5aca064d19d54f60f1c00a69
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/bitint-25.c
@@ -0,0 +1,18 @@
+// PR c/102989
+// { dg-do compile { target bitint } }
+// { dg-options "-std=c11 -Wno-c11-c2x-compat -pedantic-errors" }
+
+_BitInt(63) a;
+signed _BitInt(15) b;
+unsigned _BitInt(31) c;
+int d = 21wb;
+long long e = 60594869054uwb;
+__extension__ _BitInt(63) f;
+__extension__ _BitInt(15) g;
+__extension__ unsigned _BitInt(31) h;
+int i = __extension__ 21wb;
+long long j = __extension__ 60594869054uwb;
+#if 0wb == 0
+#endif
+#if 0uwb == 0
+#endif
diff --git a/gcc/testsuite/gcc.dg/bitint-26.c b/gcc/testsuite/gcc.dg/bitint-26.c
new file mode 100644
index 0000000000000000000000000000000000000000..c5ce1acdaaf87a0b68f6fdcca6348900fa952e36
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/bitint-26.c
@@ -0,0 +1,18 @@
+// PR c/102989
+// { dg-do compile { target bitint } }
+// { dg-options "-std=c11 -pedantic" }
+
+_BitInt(63) a;					/* { dg-warning "ISO C does not support '_BitInt\\\(63\\\)' before C2X" } */
+signed _BitInt(15) b;				/* { dg-warning "ISO C does not support 'signed _BitInt\\\(15\\\)' before C2X" } */
+unsigned _BitInt(31) c;				/* { dg-warning "ISO C does not support 'unsigned _BitInt\\\(31\\\)' before C2X" } */
+int d = 21wb;					/* { dg-warning "ISO C does not support literal 'wb' suffixes before C2X" } */
+long long e = 60594869054uwb;			/* { dg-warning "ISO C does not support literal 'wb' suffixes before C2X" } */
+__extension__ _BitInt(63) f;
+__extension__ _BitInt(15) g;
+__extension__ unsigned _BitInt(31) h;
+int i = __extension__ 21wb;
+long long j = __extension__ 60594869054uwb;
+#if 0wb == 0					/* { dg-warning "ISO C does not support literal 'wb' suffixes before C2X" } */
+#endif
+#if 0uwb == 0					/* { dg-warning "ISO C does not support literal 'wb' suffixes before C2X" } */
+#endif
diff --git a/gcc/testsuite/gcc.dg/bitint-27.c b/gcc/testsuite/gcc.dg/bitint-27.c
new file mode 100644
index 0000000000000000000000000000000000000000..e85f28830ec3179f6088c1823a2c011ebb34b16a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/bitint-27.c
@@ -0,0 +1,18 @@
+// PR c/102989
+// { dg-do compile { target bitint } }
+// { dg-options "-std=c11 -pedantic-errors" }
+
+_BitInt(63) a;					/* { dg-error "ISO C does not support '_BitInt\\\(63\\\)' before C2X" } */
+signed _BitInt(15) b;				/* { dg-error "ISO C does not support 'signed _BitInt\\\(15\\\)' before C2X" } */
+unsigned _BitInt(31) c;				/* { dg-error "ISO C does not support 'unsigned _BitInt\\\(31\\\)' before C2X" } */
+int d = 21wb;					/* { dg-error "ISO C does not support literal 'wb' suffixes before C2X" } */
+long long e = 60594869054uwb;			/* { dg-error "ISO C does not support literal 'wb' suffixes before C2X" } */
+__extension__ _BitInt(63) f;
+__extension__ _BitInt(15) g;
+__extension__ unsigned _BitInt(31) h;
+int i = __extension__ 21wb;
+long long j = __extension__ 60594869054uwb;
+#if 0wb == 0					/* { dg-error "ISO C does not support literal 'wb' suffixes before C2X" } */
+#endif
+#if 0uwb == 0					/* { dg-error "ISO C does not support literal 'wb' suffixes before C2X" } */
+#endif
diff --git a/libcpp/expr.cc b/libcpp/expr.cc
index b68bf0f9ab12e09217fd1ecad0d47f06cd485470..338395a2c44c6c499fd29e5cae6a13b77062ed23 100644
--- a/libcpp/expr.cc
+++ b/libcpp/expr.cc
@@ -856,6 +856,29 @@ cpp_classify_number (cpp_reader *pfile, const cpp_token *token,
 				 virtual_location, 0, message);
        }
 
+      if ((result & CPP_N_BITINT) != 0
+	  && CPP_OPTION (pfile, cpp_warn_c11_c2x_compat) != 0)
+	{
+	  if (CPP_OPTION (pfile, cpp_warn_c11_c2x_compat) > 0)
+	    {
+	      const char *message = N_("ISO C does not support literal "
+				       "%<wb%> suffixes before C2X");
+	      if (CPP_PEDANTIC (pfile) && !CPP_OPTION (pfile, true_false))
+		cpp_pedwarning_with_line (pfile, CPP_W_C11_C2X_COMPAT,
+					  virtual_location, 0, message);
+	      else
+		cpp_warning_with_line (pfile, CPP_W_C11_C2X_COMPAT,
+				       virtual_location, 0, message);
+	    }
+	  else if (CPP_PEDANTIC (pfile) && !CPP_OPTION (pfile, true_false))
+	    {
+	      const char *message = N_("ISO C does not support literal "
+				       "%<wb%> suffixes before C2X");
+	      cpp_error_with_line (pfile, CPP_DL_PEDWARN, virtual_location, 0,
+				   message);
+	    }
+	}
+
       result |= CPP_N_INTEGER;
     }