diff --git a/gcc/c-family/c-ada-spec.cc b/gcc/c-family/c-ada-spec.cc index c7ae03223..744621af1 100644 --- a/gcc/c-family/c-ada-spec.cc +++ b/gcc/c-family/c-ada-spec.cc @@ -1964,6 +1964,8 @@ dump_ada_template (pretty_printer *pp, tree t, int spc) pp_string (pp, " is limited "); dump_ada_node (pp, instance, t, spc, false, false); + if (!has_nontrivial_methods (instance) && !has_static_fields (instance)) + pp_semicolon (pp); pp_newline (pp); spc -= INDENT_INCR; newline_and_indent (pp, spc); diff --git a/gcc/testsuite/g++.dg/ada-spec/template-record-termination.C b/gcc/testsuite/g++.dg/ada-spec/template-record-termination.C new file mode 100644 index 000000000..cdefa0adb --- /dev/null +++ b/gcc/testsuite/g++.dg/ada-spec/template-record-termination.C @@ -0,0 +1,75 @@ +/* { dg-do compile } */ +/* { dg-options "-std=gnu++20 -fdump-ada-spec-slim" } */ +/* { dg-final { scan-file template_record_termination_c.ads "with Convention => C_Pass_By_Copy;" } } */ + +template +struct Plain +{ + T value; +}; + +template struct Plain; + +template +struct Choice; + +template +struct Choice +{ + T value; +}; + +template struct Choice; + +template +struct Specialized +{ + T value; +}; + +template <> +struct Specialized +{ + unsigned value; +}; + +using Bool_Specialized = Specialized; + +template +struct Outer +{ + template + struct Inner + { + U value; + }; +}; + +template struct Outer; + +template +concept Integral_Sized = sizeof (T) >= sizeof (int); + +template +struct Constrained +{ + T value; +}; + +template struct Constrained; + +template +struct Item +{ + T value; +}; + +template