public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug ada/114636] New: Actual does not match formal in generic instantiation
@ 2024-04-08 10:17 simon at pushface dot org
2024-04-20 14:33 ` [Bug ada/114636] actual does not match formal in instantiation with formal package ebotcazou at gcc dot gnu.org
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: simon at pushface dot org @ 2024-04-08 10:17 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114636
Bug ID: 114636
Summary: Actual does not match formal in generic instantiation
Product: gcc
Version: 14.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: ada
Assignee: unassigned at gcc dot gnu.org
Reporter: simon at pushface dot org
CC: dkm at gcc dot gnu.org
Target Milestone: ---
Created attachment 57899
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=57899&action=edit
example.adb
Compiler can’t match an actual type with a formal.
This appears to have been present from GCC 8.2, and is still present.
Could it be related to PR24480?
$ gnatmake -gnatl example.adb
gcc -c -gnatl example.adb
GNAT 13.2.1
Copyright 1992-2023, Free Software Foundation, Inc.
Compiling: example.adb
Source file time stamp: 2024-04-08 09:57:34
Compiled at: 2024-04-08 11:09:37
1. procedure Example is
2. generic
3. type Terminals is (<>);
4. type Nonterminals is (<>);
5. package Types is
6. type Action is record
7. data : Integer;
8. end record;
9. end Types;
10.
11. generic
12. type States is (<>);
13. type Input_T is (<>);
14. type Action_T is private;
15. package FSM is
16. end FSM;
17.
18. generic
19. with package Typs is new Types (<>);
20. with package SMs is new FSM
21. (States => <>, Input_T => Typs.Terminals, Action_T =>
Typs.Action);
22. package Gen is
23. end Gen;
24.
25. package Typs is new Types (Natural, Integer);
26. package SMs is new FSM (Integer, Natural, Typs.Action);
27. package Generator is new Gen (Typs, SMs);
|
>>> error: actual for "Action_T" in actual instance does not match
formal
28. begin
29. null;
30. end Example;
30 lines: 1 error
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug ada/114636] actual does not match formal in instantiation with formal package
2024-04-08 10:17 [Bug ada/114636] New: Actual does not match formal in generic instantiation simon at pushface dot org
@ 2024-04-20 14:33 ` ebotcazou at gcc dot gnu.org
2024-04-20 14:34 ` ebotcazou at gcc dot gnu.org
2024-04-20 14:35 ` ebotcazou at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: ebotcazou at gcc dot gnu.org @ 2024-04-20 14:33 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114636
Eric Botcazou <ebotcazou at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|Actual does not match |actual does not match
|formal in generic |formal in instantiation
|instantiation |with formal package
Status|UNCONFIRMED |NEW
Ever confirmed|0 |1
Last reconfirmed| |2024-04-20
CC| |ebotcazou at gcc dot gnu.org
--- Comment #1 from Eric Botcazou <ebotcazou at gcc dot gnu.org> ---
This comes from the formal discrete types and has probably never worked.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug ada/114636] actual does not match formal in instantiation with formal package
2024-04-08 10:17 [Bug ada/114636] New: Actual does not match formal in generic instantiation simon at pushface dot org
2024-04-20 14:33 ` [Bug ada/114636] actual does not match formal in instantiation with formal package ebotcazou at gcc dot gnu.org
@ 2024-04-20 14:34 ` ebotcazou at gcc dot gnu.org
2024-04-20 14:35 ` ebotcazou at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: ebotcazou at gcc dot gnu.org @ 2024-04-20 14:34 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114636
--- Comment #2 from Eric Botcazou <ebotcazou at gcc dot gnu.org> ---
This appears to be sufficient:
diff --git a/gcc/ada/sem_ch12.adb b/gcc/ada/sem_ch12.adb
index e7b759c4e88..c06377ab4c9 100644
--- a/gcc/ada/sem_ch12.adb
+++ b/gcc/ada/sem_ch12.adb
@@ -6696,8 +6696,12 @@ package body Sem_Ch12 is
then
-- If the formal is a tagged type the corresponding class-wide
-- type has been generated as well, and it must be skipped.
+ -- Likewise, for a formal discrete type, the base type has been
+ -- generated as well (see Analyze_Formal_Discrete_Type).
- if Is_Type (E2) and then Is_Tagged_Type (E2) then
+ if Is_Type (E2)
+ and then (Is_Tagged_Type (E2) or else Is_Enumeration_Type (E2))
+ then
Next_Entity (E2);
end if;
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug ada/114636] actual does not match formal in instantiation with formal package
2024-04-08 10:17 [Bug ada/114636] New: Actual does not match formal in generic instantiation simon at pushface dot org
2024-04-20 14:33 ` [Bug ada/114636] actual does not match formal in instantiation with formal package ebotcazou at gcc dot gnu.org
2024-04-20 14:34 ` ebotcazou at gcc dot gnu.org
@ 2024-04-20 14:35 ` ebotcazou at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: ebotcazou at gcc dot gnu.org @ 2024-04-20 14:35 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114636
Eric Botcazou <ebotcazou at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Assignee|unassigned at gcc dot gnu.org |ebotcazou at gcc dot gnu.org
Status|NEW |ASSIGNED
--- Comment #3 from Eric Botcazou <ebotcazou at gcc dot gnu.org> ---
I'll test the above fixlet.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-04-20 14:35 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-08 10:17 [Bug ada/114636] New: Actual does not match formal in generic instantiation simon at pushface dot org
2024-04-20 14:33 ` [Bug ada/114636] actual does not match formal in instantiation with formal package ebotcazou at gcc dot gnu.org
2024-04-20 14:34 ` ebotcazou at gcc dot gnu.org
2024-04-20 14:35 ` ebotcazou at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).