public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/27065]  New: error: array type has incomplete element type
@ 2006-04-06 18:25 rdabrowa at poczta dot onet dot pl
  2006-04-06 18:42 ` [Bug c/27065] " pinskia at gcc dot gnu dot org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: rdabrowa at poczta dot onet dot pl @ 2006-04-06 18:25 UTC (permalink / raw)
  To: gcc-bugs

a code below:
    struct foo {
        void (*pf)(struct foo (*ptr)[2]); /* error */
    };
causes to report the following error:
    ts.c:4: error: array type has incomplete element type

Isn't the compiler too restrictive ?
Even a typedef is rejected by compiler:
   struct foo;
   typedef struct foo (*foo_tab_ptr)[2];
   typedef void (*pfun)(struct foo[2]);
or a function declaration:
   void f(struct foo[]);


-- 
           Summary: error: array type has incomplete element type
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: rdabrowa at poczta dot onet dot pl
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27065


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c/27065] error: array type has incomplete element type
  2006-04-06 18:25 [Bug c/27065] New: error: array type has incomplete element type rdabrowa at poczta dot onet dot pl
@ 2006-04-06 18:42 ` pinskia at gcc dot gnu dot org
  2006-04-06 19:09 ` rdabrowa at poczta dot onet dot pl
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-04-06 18:42 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2006-04-06 18:42 -------
This is invalid code, yes it might had been accepted before 4.1.0 but it was
still invalid code.  The array to pointer decay happens after the type is
completed for functions so the element of the array type has to be complete
still.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27065


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c/27065] error: array type has incomplete element type
  2006-04-06 18:25 [Bug c/27065] New: error: array type has incomplete element type rdabrowa at poczta dot onet dot pl
  2006-04-06 18:42 ` [Bug c/27065] " pinskia at gcc dot gnu dot org
@ 2006-04-06 19:09 ` rdabrowa at poczta dot onet dot pl
  2009-11-05  0:43 ` pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: rdabrowa at poczta dot onet dot pl @ 2006-04-06 19:09 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from rdabrowa at poczta dot onet dot pl  2006-04-06 19:09 -------
(In reply to comment #1)
> This is invalid code, yes it might had been accepted before 4.1.0 but it was
> still invalid code.  The array to pointer decay happens after the type is
> completed for functions so the element of the array type has to be complete
> still.
> 
What happens ?
Consider the following code:
    struct foo {
        void (*pf)();
    };
Later I can write:
    void f(struct foo (*ptr)[2]);
    struct foo x;
    x.pf = f;
This compiles fine, but now I can assign any function to pf. Why I can't
specify required function prototype ? I can't understand this. 


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27065


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c/27065] error: array type has incomplete element type
  2006-04-06 18:25 [Bug c/27065] New: error: array type has incomplete element type rdabrowa at poczta dot onet dot pl
  2006-04-06 18:42 ` [Bug c/27065] " pinskia at gcc dot gnu dot org
  2006-04-06 19:09 ` rdabrowa at poczta dot onet dot pl
@ 2009-11-05  0:43 ` pinskia at gcc dot gnu dot org
  2009-11-05  0:45 ` [Bug c/27065] [4.3/4.4/4.5 Regression] " pinskia at gcc dot gnu dot org
  2009-11-05  1:08 ` pinskia at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2009-11-05  0:43 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from pinskia at gcc dot gnu dot org  2009-11-05 00:42 -------
Actually this is valid C99 code after all.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |UNCONFIRMED
         Resolution|INVALID                     |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27065


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c/27065] [4.3/4.4/4.5 Regression] error: array type has incomplete element type
  2006-04-06 18:25 [Bug c/27065] New: error: array type has incomplete element type rdabrowa at poczta dot onet dot pl
                   ` (2 preceding siblings ...)
  2009-11-05  0:43 ` pinskia at gcc dot gnu dot org
@ 2009-11-05  0:45 ` pinskia at gcc dot gnu dot org
  2009-11-05  1:08 ` pinskia at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2009-11-05  0:45 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from pinskia at gcc dot gnu dot org  2009-11-05 00:45 -------
6.7.5.3/4 says:
After adjustment, the parameters in the a parameter type list in a function
declarator that is part of a definition of that function shall not have
incomplete type.

But the adjustment is the decaying from [] to * which is mentioned in
6.7.5.3/7.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
           Keywords|                            |rejects-valid
   Last reconfirmed|0000-00-00 00:00:00         |2009-11-05 00:45:37
               date|                            |
            Summary|error: array type has       |[4.3/4.4/4.5 Regression]
                   |incomplete element type     |error: array type has
                   |                            |incomplete element type
   Target Milestone|---                         |4.3.5


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27065


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug c/27065] [4.3/4.4/4.5 Regression] error: array type has incomplete element type
  2006-04-06 18:25 [Bug c/27065] New: error: array type has incomplete element type rdabrowa at poczta dot onet dot pl
                   ` (3 preceding siblings ...)
  2009-11-05  0:45 ` [Bug c/27065] [4.3/4.4/4.5 Regression] " pinskia at gcc dot gnu dot org
@ 2009-11-05  1:08 ` pinskia at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2009-11-05  1:08 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from pinskia at gcc dot gnu dot org  2009-11-05 01:08 -------
Actually I take that back, C99 explicitly says arrays cannot be an incomplete
type.  See 6.7.5.2/1.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |INVALID


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27065


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2009-11-05  1:08 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-04-06 18:25 [Bug c/27065] New: error: array type has incomplete element type rdabrowa at poczta dot onet dot pl
2006-04-06 18:42 ` [Bug c/27065] " pinskia at gcc dot gnu dot org
2006-04-06 19:09 ` rdabrowa at poczta dot onet dot pl
2009-11-05  0:43 ` pinskia at gcc dot gnu dot org
2009-11-05  0:45 ` [Bug c/27065] [4.3/4.4/4.5 Regression] " pinskia at gcc dot gnu dot org
2009-11-05  1:08 ` pinskia at gcc dot gnu dot 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).