public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/37962] [4.4 regression] ICE with (auto*) casts
  2008-10-30 20:23 [Bug c++/37962] New: [4.4 regression] ICE with (auto*) casts reichelt at gcc dot gnu dot org
@ 2008-10-30 20:23 ` reichelt at gcc dot gnu dot org
  2008-10-30 21:00 ` rguenth at gcc dot gnu dot org
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2008-10-30 20:23 UTC (permalink / raw)
  To: gcc-bugs



-- 

reichelt at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.4.0


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


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

* [Bug c++/37962]  New: [4.4 regression] ICE with (auto*) casts
@ 2008-10-30 20:23 reichelt at gcc dot gnu dot org
  2008-10-30 20:23 ` [Bug c++/37962] " reichelt at gcc dot gnu dot org
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2008-10-30 20:23 UTC (permalink / raw)
  To: gcc-bugs

The following code snippet triggers an ICE on mainline:

========================
int i = *(auto*)0;
========================

bug.cc:1: internal compiler error: tree check: expected record_type or
union_type or qual_union_type, have template_type_parm in lookup_conversions,
at cp/search.c:2459
Please submit a full bug report, [etc.]


A slightly different version triggers a similar ICE in a different place:

========================
struct A* p = (auto*)0;
========================

bug.cc:1: internal compiler error: tree check: expected record_type or
union_type or qual_union_type, have template_type_parm in lookup_base, at
cp/search.c:214
Please submit a full bug report, [etc.]

The bugs appeared with the patches for the new 'auto' semantics.


-- 
           Summary: [4.4 regression] ICE with (auto*) casts
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Keywords: ice-on-invalid-code, monitored
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: reichelt at gcc dot gnu dot org


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


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

* [Bug c++/37962] [4.4 regression] ICE with (auto*) casts
  2008-10-30 20:23 [Bug c++/37962] New: [4.4 regression] ICE with (auto*) casts reichelt at gcc dot gnu dot org
  2008-10-30 20:23 ` [Bug c++/37962] " reichelt at gcc dot gnu dot org
@ 2008-10-30 21:00 ` rguenth at gcc dot gnu dot org
  2008-10-31 11:00 ` jakub at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2008-10-30 21:00 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from rguenth at gcc dot gnu dot org  2008-10-30 20:58 -------
Confirmed.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
      Known to work|                            |4.3.2
           Priority|P3                          |P2
   Last reconfirmed|0000-00-00 00:00:00         |2008-10-30 20:58:30
               date|                            |


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


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

* [Bug c++/37962] [4.4 regression] ICE with (auto*) casts
  2008-10-30 20:23 [Bug c++/37962] New: [4.4 regression] ICE with (auto*) casts reichelt at gcc dot gnu dot org
  2008-10-30 20:23 ` [Bug c++/37962] " reichelt at gcc dot gnu dot org
  2008-10-30 21:00 ` rguenth at gcc dot gnu dot org
@ 2008-10-31 11:00 ` jakub at gcc dot gnu dot org
  2008-10-31 11:28 ` jakub at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu dot org @ 2008-10-31 11:00 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from jakub at gcc dot gnu dot org  2008-10-31 10:59 -------
Certainly e.g. cp_parser_cast_expression and cp_parser_postfix_expression
could reject types with type_uses_auto, but doesn't [dcl.spec.auto] specify
only very limited number of places where auto can be used and the rest:
"A program that uses auto in a context not explicitly allowed in this section
is ill-formed."?
Enumerating all the places which parse types and auto isn't explicitly allowed
would be IMHO difficult, wouldn't it be better to add a new flag (say to
enum cp_parser_flags, CP_PARSER_FLAGS_AUTO_ALLOWED) and pass it down to
cp_parser_type_specifier*?  Guess we might still need a type_uses_auto check
in a couple of places, but it will be certainly less than if we parse auto all
the time and let all the callers check for it.
E.g. ATM g++ parses without any errors:
#include <typeinfo>
const std::type_info &foo ()
{
  return typeid (auto);
}
const std::type_info &bar ()
{
  return typeid (auto *);
}
and returns _ZTIT_ and _ZTIPT_, which looks wrong.
BTW, seems a lot of cp_parser_type_specifier* callers still think the flags
argument is boolean and pass /*is_condition=*/false or /*is_condition=*/true to
it.


-- 

jakub at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dodji at gcc dot gnu dot org


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


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

* [Bug c++/37962] [4.4 regression] ICE with (auto*) casts
  2008-10-30 20:23 [Bug c++/37962] New: [4.4 regression] ICE with (auto*) casts reichelt at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2008-10-31 11:28 ` jakub at gcc dot gnu dot org
@ 2008-10-31 11:28 ` jakub at gcc dot gnu dot org
  2008-10-31 11:30 ` jakub at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu dot org @ 2008-10-31 11:28 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from jakub at gcc dot gnu dot org  2008-10-31 11:27 -------
*** Bug 37963 has been marked as a duplicate of this bug. ***


-- 


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


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

* [Bug c++/37962] [4.4 regression] ICE with (auto*) casts
  2008-10-30 20:23 [Bug c++/37962] New: [4.4 regression] ICE with (auto*) casts reichelt at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2008-10-31 11:00 ` jakub at gcc dot gnu dot org
@ 2008-10-31 11:28 ` jakub at gcc dot gnu dot org
  2008-10-31 11:28 ` jakub at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu dot org @ 2008-10-31 11:28 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from jakub at gcc dot gnu dot org  2008-10-31 11:26 -------
Testcase that covers more cases which should be rejected:
#include <typeinfo>

int i = *(auto *) 0;// { dg-error "" }
struct A *p = (auto *) 0;// { dg-error "" }
int *q = static_cast<auto *>(0);// { dg-error "" }
const int *r = const_cast<auto *>(q);// { dg-error "" }
const std::type_info &t1 = typeid (auto);// { dg-error "" }
const std::type_info &t2 = typeid (auto *);// { dg-error "" }

struct A
{
  operator auto ();// { dg-error "" }
  operator auto * ();// { dg-error "" }
};

void
foo ()
{
  (auto) { 0 };// { dg-error "" }
}


-- 


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


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

* [Bug c++/37962] [4.4 regression] ICE with (auto*) casts
  2008-10-30 20:23 [Bug c++/37962] New: [4.4 regression] ICE with (auto*) casts reichelt at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2008-10-31 11:28 ` jakub at gcc dot gnu dot org
@ 2008-10-31 11:28 ` jakub at gcc dot gnu dot org
  2008-10-31 11:28 ` jakub at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu dot org @ 2008-10-31 11:28 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from jakub at gcc dot gnu dot org  2008-10-31 11:27 -------
*** Bug 37964 has been marked as a duplicate of this bug. ***


-- 


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


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

* [Bug c++/37962] [4.4 regression] ICE with (auto*) casts
  2008-10-30 20:23 [Bug c++/37962] New: [4.4 regression] ICE with (auto*) casts reichelt at gcc dot gnu dot org
                   ` (5 preceding siblings ...)
  2008-10-31 11:28 ` jakub at gcc dot gnu dot org
@ 2008-10-31 11:30 ` jakub at gcc dot gnu dot org
  2008-10-31 16:03 ` jakub at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu dot org @ 2008-10-31 11:30 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from jakub at gcc dot gnu dot org  2008-10-31 11:28 -------
*** Bug 37966 has been marked as a duplicate of this bug. ***


-- 


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


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

* [Bug c++/37962] [4.4 regression] ICE with (auto*) casts
  2008-10-30 20:23 [Bug c++/37962] New: [4.4 regression] ICE with (auto*) casts reichelt at gcc dot gnu dot org
                   ` (6 preceding siblings ...)
  2008-10-31 11:30 ` jakub at gcc dot gnu dot org
@ 2008-10-31 16:03 ` jakub at gcc dot gnu dot org
  2008-11-12 22:19 ` jason at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu dot org @ 2008-10-31 16:03 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from jakub at gcc dot gnu dot org  2008-10-31 16:01 -------
*** Bug 37968 has been marked as a duplicate of this bug. ***


-- 


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


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

* [Bug c++/37962] [4.4 regression] ICE with (auto*) casts
  2008-10-30 20:23 [Bug c++/37962] New: [4.4 regression] ICE with (auto*) casts reichelt at gcc dot gnu dot org
                   ` (7 preceding siblings ...)
  2008-10-31 16:03 ` jakub at gcc dot gnu dot org
@ 2008-11-12 22:19 ` jason at gcc dot gnu dot org
  2008-11-18 18:14 ` jason at gcc dot gnu dot org
  2008-11-18 18:16 ` jason at gcc dot gnu dot org
  10 siblings, 0 replies; 12+ messages in thread
From: jason at gcc dot gnu dot org @ 2008-11-12 22:19 UTC (permalink / raw)
  To: gcc-bugs



-- 

jason at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |jason at gcc dot gnu dot org
                   |dot org                     |
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2008-10-30 20:58:30         |2008-11-12 22:18:10
               date|                            |


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


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

* [Bug c++/37962] [4.4 regression] ICE with (auto*) casts
  2008-10-30 20:23 [Bug c++/37962] New: [4.4 regression] ICE with (auto*) casts reichelt at gcc dot gnu dot org
                   ` (8 preceding siblings ...)
  2008-11-12 22:19 ` jason at gcc dot gnu dot org
@ 2008-11-18 18:14 ` jason at gcc dot gnu dot org
  2008-11-18 18:16 ` jason at gcc dot gnu dot org
  10 siblings, 0 replies; 12+ messages in thread
From: jason at gcc dot gnu dot org @ 2008-11-18 18:14 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from jason at gcc dot gnu dot org  2008-11-18 18:12 -------
Subject: Bug 37962

Author: jason
Date: Tue Nov 18 18:11:32 2008
New Revision: 141970

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=141970
Log:
        PR c++/37962
cp/
        * parser.c (cp_parser_type_id): Complain about auto.
        * decl.c (grokdeclarator): Complain about parameters and
        conversion functions declared with auto.
        * call.c (standard_conversion): Use CLASS_TYPE_P instead of
        MAYBE_CLASS_TYPE_P.
        * cp-tree.h (TYPE_NON_AGGREGATE_CLASS): Likewise.
testsuite/
        * g++.dg/cpp0x/auto[38].C: Adjust expected errors.
        * g++.dg/cpp0x/auto9.C: New test.
        * g++.dg/cpp0x/auto10.C: New test.

Added:
    trunk/gcc/testsuite/g++.dg/cpp0x/auto10.C
    trunk/gcc/testsuite/g++.dg/cpp0x/auto9.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/call.c
    trunk/gcc/cp/cp-tree.h
    trunk/gcc/cp/decl.c
    trunk/gcc/cp/parser.c
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/g++.dg/cpp0x/auto3.C
    trunk/gcc/testsuite/g++.dg/cpp0x/auto8.C


-- 


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


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

* [Bug c++/37962] [4.4 regression] ICE with (auto*) casts
  2008-10-30 20:23 [Bug c++/37962] New: [4.4 regression] ICE with (auto*) casts reichelt at gcc dot gnu dot org
                   ` (9 preceding siblings ...)
  2008-11-18 18:14 ` jason at gcc dot gnu dot org
@ 2008-11-18 18:16 ` jason at gcc dot gnu dot org
  10 siblings, 0 replies; 12+ messages in thread
From: jason at gcc dot gnu dot org @ 2008-11-18 18:16 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from jason at gcc dot gnu dot org  2008-11-18 18:14 -------
Fixed.


-- 

jason at gcc dot gnu dot org changed:

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


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


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

end of thread, other threads:[~2008-11-18 18:16 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-10-30 20:23 [Bug c++/37962] New: [4.4 regression] ICE with (auto*) casts reichelt at gcc dot gnu dot org
2008-10-30 20:23 ` [Bug c++/37962] " reichelt at gcc dot gnu dot org
2008-10-30 21:00 ` rguenth at gcc dot gnu dot org
2008-10-31 11:00 ` jakub at gcc dot gnu dot org
2008-10-31 11:28 ` jakub at gcc dot gnu dot org
2008-10-31 11:28 ` jakub at gcc dot gnu dot org
2008-10-31 11:28 ` jakub at gcc dot gnu dot org
2008-10-31 11:30 ` jakub at gcc dot gnu dot org
2008-10-31 16:03 ` jakub at gcc dot gnu dot org
2008-11-12 22:19 ` jason at gcc dot gnu dot org
2008-11-18 18:14 ` jason at gcc dot gnu dot org
2008-11-18 18:16 ` jason 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).