public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/17150] New: Ugly diagnostics for invalid variably modified type
@ 2004-08-23 13:01 falk at debian dot org
  2004-08-23 13:05 ` [Bug c++/17150] " pinskia at gcc dot gnu dot org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: falk at debian dot org @ 2004-08-23 13:01 UTC (permalink / raw)
  To: gcc-bugs

This test case posted for PR 17148:

struct A {};
struct B : A
{
    static int foo() { return 1; }
    int i[B::foo()];
};

produces the ugly diagnostic:

test.cc:6: error: data member may not have variably modified type `int [(((long
unsigned int)(((long int)B::foo()) - 1)) + 1u)]'

with g++ 3.5.0 20040815 on alphaev68-unknown-linux-gnu.

-- 
           Summary: Ugly diagnostics for invalid variably modified type
           Product: gcc
           Version: 3.5.0
            Status: UNCONFIRMED
          Keywords: diagnostic
          Severity: minor
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: falk at debian dot org
                CC: gcc-bugs at gcc dot gnu dot org


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


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

* [Bug c++/17150] Ugly diagnostics for invalid variably modified type
  2004-08-23 13:01 [Bug c++/17150] New: Ugly diagnostics for invalid variably modified type falk at debian dot org
@ 2004-08-23 13:05 ` pinskia at gcc dot gnu dot org
  2004-08-23 13:48 ` bangerth at dealii dot org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-08-23 13:05 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-08-23 13:05 -------
Confirmed.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2004-08-23 13:05:32
               date|                            |


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


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

* [Bug c++/17150] Ugly diagnostics for invalid variably modified type
  2004-08-23 13:01 [Bug c++/17150] New: Ugly diagnostics for invalid variably modified type falk at debian dot org
  2004-08-23 13:05 ` [Bug c++/17150] " pinskia at gcc dot gnu dot org
@ 2004-08-23 13:48 ` bangerth at dealii dot org
  2004-08-29 15:31 ` gdr at gcc dot gnu dot org
  2005-06-19 14:13 ` falk at debian dot org
  3 siblings, 0 replies; 5+ messages in thread
From: bangerth at dealii dot org @ 2004-08-23 13:48 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From bangerth at dealii dot org  2004-08-23 13:48 -------
There is at least one duplicate of this already. Someone may want 
to go find out which PR it is. 
 
W. 

-- 


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


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

* [Bug c++/17150] Ugly diagnostics for invalid variably modified type
  2004-08-23 13:01 [Bug c++/17150] New: Ugly diagnostics for invalid variably modified type falk at debian dot org
  2004-08-23 13:05 ` [Bug c++/17150] " pinskia at gcc dot gnu dot org
  2004-08-23 13:48 ` bangerth at dealii dot org
@ 2004-08-29 15:31 ` gdr at gcc dot gnu dot org
  2005-06-19 14:13 ` falk at debian dot org
  3 siblings, 0 replies; 5+ messages in thread
From: gdr at gcc dot gnu dot org @ 2004-08-29 15:31 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From gdr at gcc dot gnu dot org  2004-08-29 15:31 -------
(In reply to comment #0)
> This test case posted for PR 17148:
> 
> struct A {};
> struct B : A
> {
>     static int foo() { return 1; }
>     int i[B::foo()];
> };
> 
> produces the ugly diagnostic:
> 
> test.cc:6: error: data member may not have variably modified type `int [(((long
> unsigned int)(((long int)B::foo()) - 1)) + 1u)]'

This stupid pretty printing comes from the way GCC currently handles arrays.
When you declare an array 

     T i[N];

GCC represents the index values as a range type 0...(N-1), hence the curious
-1.  Latter, when pretty printing, we try to recover that off-one thingy, hence
the curious +1.  The unsignedness come from one more GCC artefact.
Notice that fold() is unable to smash that nonsense down to the trivial thing.
A way out of this mess is to stop fiddling with what user writes and define
normal forms for expressions, with some ordering.

-- Gaby


> 
> with g++ 3.5.0 20040815 on alphaev68-unknown-linux-gnu.



-- 


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


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

* [Bug c++/17150] Ugly diagnostics for invalid variably modified type
  2004-08-23 13:01 [Bug c++/17150] New: Ugly diagnostics for invalid variably modified type falk at debian dot org
                   ` (2 preceding siblings ...)
  2004-08-29 15:31 ` gdr at gcc dot gnu dot org
@ 2005-06-19 14:13 ` falk at debian dot org
  3 siblings, 0 replies; 5+ messages in thread
From: falk at debian dot org @ 2005-06-19 14:13 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From falk at debian dot org  2005-06-19 14:13 -------
Mainline "fixes" this now by chickening out and just printing:

test.cc:5: error: array bound is not an integer constant


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


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


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

end of thread, other threads:[~2005-06-19 14:13 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-08-23 13:01 [Bug c++/17150] New: Ugly diagnostics for invalid variably modified type falk at debian dot org
2004-08-23 13:05 ` [Bug c++/17150] " pinskia at gcc dot gnu dot org
2004-08-23 13:48 ` bangerth at dealii dot org
2004-08-29 15:31 ` gdr at gcc dot gnu dot org
2005-06-19 14:13 ` falk at debian 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).