@@ -8958,6 +8958,7 @@ make_base_init_ok (tree exp)
call target. It would be possible to splice in the appropriate
arguments, but probably not worth the complexity. */
return false;
+ mark_used (fn);
AGGR_INIT_EXPR_FN (exp) = build_address (fn);
return true;
}
new file mode 100644
@@ -0,0 +1,24 @@
+// PR c++/102045
+// { dg-do link { target c++17 } }
+
+template<typename T>
+struct span
+{
+ template<unsigned long N>
+ constexpr span(T (&a)[N]) : data(a), len(N) { }
+ constexpr bool empty() const { return len == 0; }
+ T* data;
+ unsigned long len;
+};
+
+struct byte_writer: span<char> {
+ constexpr void do_something() noexcept {
+ (void)this->empty();
+ }
+};
+
+int main() {
+ char array[1];
+ auto writer = byte_writer{array};
+ writer.do_something();
+}