# \[GNAT\] can't decide on () vs \[\]

**URL:** <https://forum.ada-lang.io/t/gnat-cant-decide-on-vs/1631>\
**Category:** General\
**Tags:** ada, gnat\
**Created:** [December 23, 2024, 6:12pm UTC](https://forum.ada-lang.io/t/gnat-cant-decide-on-vs/1631 "2024-12-23T18:12:04Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![krischik](https://forum.ada-lang.io/user_avatar/forum.ada-lang.io/krischik/32/420_2.png) [@krischik](https://forum.ada-lang.io/u/krischik)\
**Post date:** [December 23, 2024, 6:12pm UTC](https://forum.ada-lang.io/t/gnat-cant-decide-on-vs/1631/1 "2024-12-23T18:12:04Z")

</div>

I got the following error message:

```console
src/adacl_test-queue.adb|26 col 4 error| instantiation error at adacl-queue-protect.adb:120
src/adacl_test-queue.adb|26 col 4 error| record aggregate must use (), not []

```

Not the difficult as there is only one set of `[]` in adacl-queue-protect.adb line 120. However when I change it I get:

```console
/Users/Shared/Work/Projects/AdaCL/adacl/src/adacl-queue-protect.adb|120 col 18| error: container aggregate must use [], not ()
/Users/Shared/Work/Projects/AdaCL/adacl/src/adacl-queue-protect.adb|120 col 18| error: container aggregate must use [], not ()

```

The 2nd error message is the correct one as it’s indeed an container aggregate.

What to do? For now I use the `&` operator. That seem to work.

---

<div class="post-metadata">

**Author:** ![jere](https://forum.ada-lang.io/user_avatar/forum.ada-lang.io/jere/32/87_2.png) [@jere](https://forum.ada-lang.io/u/jere)\
**Post date:** [December 23, 2024, 6:58pm UTC](https://forum.ada-lang.io/t/gnat-cant-decide-on-vs/1631/2 "2024-12-23T18:58:43Z")

</div>

it would depend on the two lines of code there (and any definitions related). One is a record aggregate and one is a container aggregate and they are different lines, so hard to say from here.

---

<div class="post-metadata">

**Author:** ![krischik](https://forum.ada-lang.io/user_avatar/forum.ada-lang.io/krischik/32/420_2.png) [@krischik](https://forum.ada-lang.io/u/krischik)\
**Post date:** [December 23, 2024, 7:56pm UTC](https://forum.ada-lang.io/t/gnat-cant-decide-on-vs/1631/3 "2024-12-23T19:56:35Z")

</div>

> [@jere](#):
>
> it would depend on the two lines of code there

Look at the line number: It’s only one line of code. Once with `[` and once with `(`.

It’s clearly a GNAT bug because it’s a vector of strings and not a record aggregate.

---

<div class="post-metadata">

**Author:** ![jere](https://forum.ada-lang.io/user_avatar/forum.ada-lang.io/jere/32/87_2.png) [@jere](https://forum.ada-lang.io/u/jere)\
**Post date:** [December 23, 2024, 10:11pm UTC](https://forum.ada-lang.io/t/gnat-cant-decide-on-vs/1631/4 "2024-12-23T22:11:15Z")

</div>

Sorry about that. It showed two very different column numbers, which made it look like different lines ( `26 col 4 error` vs `120 col 18`) since just changing parentheses to brackets wouldn’t normally change your column numbers.

Your best bet then is to file a bug report with GNAT on the GCC bugzilla page. They are generally pretty responsive. Here is the location: [GCC Bugzilla Main Page](https://gcc.gnu.org/bugzilla/)

---

<div class="post-metadata">

**Author:** ![krischik](https://forum.ada-lang.io/user_avatar/forum.ada-lang.io/krischik/32/420_2.png) [@krischik](https://forum.ada-lang.io/u/krischik)\
**Post date:** [December 24, 2024, 7:35am UTC](https://forum.ada-lang.io/t/gnat-cant-decide-on-vs/1631/5 "2024-12-24T07:35:00Z")

</div>

> [@jere](#):
>
> It showed two very different column numbers

That might be the work of gnatpp. Here the line in question (correct version without gnatpp):

```ada
pragma Debug (AdaCL.Trace.Entering (In_Parameters => [Container'Image, Element'Image]));

```

There are several `AdaCL.Trace.Entering` variations. The one with `In_Parameters` takes a vector of strings and the error comes on installation of the generic.

> [@jere](#):
>
> Your best bet then is to file a bug report with GNAT on the GCC bugzilla page.

I have done that before but GCC demands a shit load of auxiliary information and a self contained example. That takes 2 to 4 hours to prepare. It’s not like _„Clone this git repository, checkout this branch, type make“_. For Ada programmer it’s specifically difficult as you can’t even use `gnatmake` let along Alire to build. You have to use `gcc` to compile and I don’t even know how to do that.

Easier to just use this line instead:

```Ada
      pragma Debug (AdaCL.Trace.Entering (AdaCL.Trace.Parameter & Container'Image & Element'Image));

```

With `AdaCL.Trace.Parameter` being an empty string vector.

---

<div class="post-metadata">

**Author:** ![jere](https://forum.ada-lang.io/user_avatar/forum.ada-lang.io/jere/32/87_2.png) [@jere](https://forum.ada-lang.io/u/jere)\
**Post date:** [December 24, 2024, 1:58pm UTC](https://forum.ada-lang.io/t/gnat-cant-decide-on-vs/1631/6 "2024-12-24T13:58:08Z")

</div>

> [@krischik](#):
>
> For Ada programmer it’s specifically difficult as you can’t even use `gnatmake` let along Alire to build. You have to use `gcc` to compile and I don’t even know how to do that.

If you ever decide to look into submitting a different one in the future you can use gnatmake. It is part of GCC. All of my reports use gnatmake and have been accepted.
