diff --git a/gcc/cp/init.cc b/gcc/cp/init.cc
index de82152bd1d378c86012ea5602ac1a7e0807f5f1..20373d269882bd297a291ad121f11fbce861ff12 100644
--- a/gcc/cp/init.cc
+++ b/gcc/cp/init.cc
@@ -173,6 +173,9 @@ build_zero_init_1 (tree type, tree nelts, bool static_storage_p,
 
   gcc_assert (nelts == NULL_TREE || TREE_CODE (nelts) == INTEGER_CST);
 
+  /* An initializer is unqualified.  */
+  type = cv_unqualified (type);
+
   if (type == error_mark_node)
     ;
   else if (static_storage_p && zero_init_p (type))
diff --git a/gcc/testsuite/g++.dg/cpp1z/nontype-auto26.C b/gcc/testsuite/g++.dg/cpp1z/nontype-auto26.C
new file mode 100644
index 0000000000000000000000000000000000000000..9abe54ed9745d906c7f10c150da840a4e52b0ed1
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1z/nontype-auto26.C
@@ -0,0 +1,29 @@
+// PR c++/94568
+// { dg-do compile { target c++20 } }
+
+struct A;
+typedef int A::*MemPtr;
+
+struct B { MemPtr p; };
+
+static constexpr MemPtr mp { };
+
+template <B> struct X { };
+
+typedef X<B{{MemPtr{ }}}> XB;
+typedef X<B{{mp}}>        XB;
+
+struct C { int a[2]; };
+template <C> struct D { };
+
+constexpr const int i0 = 0;
+constexpr const int i_{ };
+
+static_assert (i0 == i_);
+
+// typedef D<C{ { 0, 1 } }>   DC01;
+// typedef D<C{ { i0, 1 } }>  DC01;
+typedef D<C{ { i_, 1 } }>  DC01;
+
+// { dg-final { scan-assembler "_Z1f1DIXtl1CtlA2_iLi0ELi1EEEEE" } }
+void f(DC01) {}
diff --git a/gcc/testsuite/g++.dg/cpp2a/nontype-class36.C b/gcc/testsuite/g++.dg/cpp2a/nontype-class36.C
index 8371eb96621f780d3e66c776bbb5d7e3a9c95807..2e6d76cd43afcee06c5d7d3e1dbf785913eb0d8b 100644
--- a/gcc/testsuite/g++.dg/cpp2a/nontype-class36.C
+++ b/gcc/testsuite/g++.dg/cpp2a/nontype-class36.C
@@ -59,7 +59,7 @@ typedef X<B{ nullptr, nullptr, mpi }>         XB00p;
 typedef X<B{ MemPtr{ }, MemPtr{ }, mpi }>     XB00p;
 typedef X<B{ mp0, MemPtr{ }, mpi }>           XB00p;
 typedef X<B{ mpn, mpn, mpi }>                 XB00p;
-typedef X<B{ mpn, mp_, mpi }>                 XB00p;  // { dg-bogus "conflicting declaration" "pr94568" { xfail *-*-* } }
+typedef X<B{ mpn, mp_, mpi }>                 XB00p;  // { dg-bogus "conflicting declaration" "pr94568" }
 
 static const constexpr MemFuncPtr mfp0 = { 0 };
 static const constexpr MemFuncPtr mfpn = { nullptr };
diff --git a/gcc/testsuite/g++.dg/cpp2a/nontype-class37.C b/gcc/testsuite/g++.dg/cpp2a/nontype-class37.C
index f5e9826d243109aaaac00419426df7d3bdc0f7ef..dc054a9939aa79a0142e636ef7b0dca590c8c95f 100644
--- a/gcc/testsuite/g++.dg/cpp2a/nontype-class37.C
+++ b/gcc/testsuite/g++.dg/cpp2a/nontype-class37.C
@@ -77,4 +77,4 @@ typedef D<C{ { 0, 1 } }>            DC01;
 typedef D<C{ { 0, 1, 0 } }>         DC01;
 typedef D<C{ { 0, 1, 0, 0 } }>      DC01;
 typedef D<C{ { 0, i1, 0, 0 } }>     DC01;
-typedef D<C{ { i0, i1, i0, i0 } }>  DC01;   // { dg-bogus "conflicting declaration" "pr94567" { xfail *-*-* } }
+typedef D<C{ { i0, i1, i0, i0 } }>  DC01;   // { dg-bogus "conflicting declaration" "pr94568" }