public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/47704] New: [4.6 regression] [C++0x] Java-related error message when trying to instantiate a strongly typed enum with new
@ 2011-02-11 18:52 a.chavasse at gmail dot com
  2011-02-11 18:55 ` [Bug c++/47704] " redi at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: a.chavasse at gmail dot com @ 2011-02-11 18:52 UTC (permalink / raw)
  To: gcc-bugs

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

           Summary: [4.6 regression] [C++0x] Java-related error message
                    when trying to instantiate a strongly typed enum with
                    new
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: a.chavasse@gmail.com


$ g++ -v
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-unknown-linux-gnu/4.6.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../gcc-src/configure --enable-lto --prefix=/usr
--enable-languages=c,c++ --disable-multilib
Thread model: posix
gcc version 4.6.0 20110211 (experimental) (GCC) 

It was built from svn trunk, revision 170055

The following code fails to compile with this error (with -std=c++0x):
bug.cpp: In function ‘int main(int, char**)’:
bug.cpp:9:7: error: call to Java constructor, while ‘jclass’ undefined

========
int main( int argc, char** argv )
{
  enum class SomeEnum
  {
    AAA,
    BBB
  };

  new SomeEnum;

  return 0;
}
========

It worked in gcc 4.5.


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

* [Bug c++/47704] [4.6 regression] [C++0x] Java-related error message when trying to instantiate a strongly typed enum with new
  2011-02-11 18:52 [Bug c++/47704] New: [4.6 regression] [C++0x] Java-related error message when trying to instantiate a strongly typed enum with new a.chavasse at gmail dot com
@ 2011-02-11 18:55 ` redi at gcc dot gnu.org
  2011-02-13 17:46 ` jsm28 at gcc dot gnu.org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: redi at gcc dot gnu.org @ 2011-02-11 18:55 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |rejects-valid
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2011.02.11 18:51:29
      Known to work|                            |4.5.2
     Ever Confirmed|0                           |1


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

* [Bug c++/47704] [4.6 regression] [C++0x] Java-related error message when trying to instantiate a strongly typed enum with new
  2011-02-11 18:52 [Bug c++/47704] New: [4.6 regression] [C++0x] Java-related error message when trying to instantiate a strongly typed enum with new a.chavasse at gmail dot com
  2011-02-11 18:55 ` [Bug c++/47704] " redi at gcc dot gnu.org
@ 2011-02-13 17:46 ` jsm28 at gcc dot gnu.org
  2011-02-14 12:23 ` jakub at gcc dot gnu.org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jsm28 at gcc dot gnu.org @ 2011-02-13 17:46 UTC (permalink / raw)
  To: gcc-bugs

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

Joseph S. Myers <jsm28 at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.6.0


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

* [Bug c++/47704] [4.6 regression] [C++0x] Java-related error message when trying to instantiate a strongly typed enum with new
  2011-02-11 18:52 [Bug c++/47704] New: [4.6 regression] [C++0x] Java-related error message when trying to instantiate a strongly typed enum with new a.chavasse at gmail dot com
  2011-02-11 18:55 ` [Bug c++/47704] " redi at gcc dot gnu.org
  2011-02-13 17:46 ` jsm28 at gcc dot gnu.org
@ 2011-02-14 12:23 ` jakub at gcc dot gnu.org
  2011-02-15 15:59 ` jakub at gcc dot gnu.org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-02-14 12:23 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-02-14 12:10:22 UTC ---
Regressed in between r165868 and r166148.


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

* [Bug c++/47704] [4.6 regression] [C++0x] Java-related error message when trying to instantiate a strongly typed enum with new
  2011-02-11 18:52 [Bug c++/47704] New: [4.6 regression] [C++0x] Java-related error message when trying to instantiate a strongly typed enum with new a.chavasse at gmail dot com
                   ` (2 preceding siblings ...)
  2011-02-14 12:23 ` jakub at gcc dot gnu.org
@ 2011-02-15 15:59 ` jakub at gcc dot gnu.org
  2011-02-15 16:09 ` jakub at gcc dot gnu.org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-02-15 15:59 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-02-15 15:48:20 UTC ---
Caused by http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=165935
The problem is that ENUM_FIXED_UNDERLYING_TYPE_P and TYPE_FOR_JAVA use the same
bit.  Now that the patch changed so that it doesn't use TYPE_LANG_FLAG_2 any
longer, can't we use that for ENUM_FIXED_UNDERLYING_TYPE_P instead of
TYPE_LANG_FLAG_3 (aka TYPE_FOR_JAVA)?


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

* [Bug c++/47704] [4.6 regression] [C++0x] Java-related error message when trying to instantiate a strongly typed enum with new
  2011-02-11 18:52 [Bug c++/47704] New: [4.6 regression] [C++0x] Java-related error message when trying to instantiate a strongly typed enum with new a.chavasse at gmail dot com
                   ` (3 preceding siblings ...)
  2011-02-15 15:59 ` jakub at gcc dot gnu.org
@ 2011-02-15 16:09 ` jakub at gcc dot gnu.org
  2011-02-15 16:22 ` jakub at gcc dot gnu.org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-02-15 16:09 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
         AssignedTo|unassigned at gcc dot       |jakub at gcc dot gnu.org
                   |gnu.org                     |

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-02-15 16:06:39 UTC ---
Created attachment 23353
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=23353
gcc46-pr47704.patch

So, either we can use TYPE_LANG_FLAG_2 here...


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

* [Bug c++/47704] [4.6 regression] [C++0x] Java-related error message when trying to instantiate a strongly typed enum with new
  2011-02-11 18:52 [Bug c++/47704] New: [4.6 regression] [C++0x] Java-related error message when trying to instantiate a strongly typed enum with new a.chavasse at gmail dot com
                   ` (4 preceding siblings ...)
  2011-02-15 16:09 ` jakub at gcc dot gnu.org
@ 2011-02-15 16:22 ` jakub at gcc dot gnu.org
  2011-02-16  9:17 ` jakub at gcc dot gnu.org
  2011-02-16 10:05 ` jakub at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-02-15 16:22 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-02-15 16:16:34 UTC ---
Created attachment 23354
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=23354
gcc46-pr47704-2.patch

Or alternatively we could use TYPE_LANG_FLAG_5 here (as TYPE_LANG_FLAG_5 so far
is only used for CLASS_TYPE_P, but only on RECORD_TYPE and UNION_TYPE codes and
CLASS_TYPE_P macro checks that first).  Therefore using it for ENUMERAL_TYPE
should be fine.

BTW, unrelated to this, I wonder if we don't need to copy over that bit
in pt.c, something like:
--- pt.c 2011-02-15 15:42:18.000000000 +0100
+++ pt.c 2011-02-15 17:14:26.212139615 +0100
@@ -6993,6 +6993,8 @@ lookup_template_class (tree d1,
               SET_SCOPED_ENUM_P (t, SCOPED_ENUM_P (template_type));
             }
           SET_OPAQUE_ENUM_P (t, OPAQUE_ENUM_P (template_type));
+          ENUM_FIXED_UNDERLYING_TYPE_P (t)
+            = ENUM_FIXED_UNDERLYING_TYPE_P (template_type);
         }
       else
         {


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

* [Bug c++/47704] [4.6 regression] [C++0x] Java-related error message when trying to instantiate a strongly typed enum with new
  2011-02-11 18:52 [Bug c++/47704] New: [4.6 regression] [C++0x] Java-related error message when trying to instantiate a strongly typed enum with new a.chavasse at gmail dot com
                   ` (5 preceding siblings ...)
  2011-02-15 16:22 ` jakub at gcc dot gnu.org
@ 2011-02-16  9:17 ` jakub at gcc dot gnu.org
  2011-02-16 10:05 ` jakub at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-02-16  9:17 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-02-16 09:08:51 UTC ---
Author: jakub
Date: Wed Feb 16 09:08:48 2011
New Revision: 170209

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=170209
Log:
    PR c++/47704
    * cp-tree.h (ENUM_FIXED_UNDERLYING_TYPE_P): Use TYPE_LANG_FLAG_5
    instead of TYPE_LANG_FLAG_3.
    * pt.c (lookup_template_class): Copy over
    ENUM_FIXED_UNDERLYING_TYPE_P.

    * g++.dg/cpp0x/enum8.C: New test.

Added:
    trunk/gcc/testsuite/g++.dg/cpp0x/enum8.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/cp-tree.h
    trunk/gcc/cp/pt.c
    trunk/gcc/testsuite/ChangeLog


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

* [Bug c++/47704] [4.6 regression] [C++0x] Java-related error message when trying to instantiate a strongly typed enum with new
  2011-02-11 18:52 [Bug c++/47704] New: [4.6 regression] [C++0x] Java-related error message when trying to instantiate a strongly typed enum with new a.chavasse at gmail dot com
                   ` (6 preceding siblings ...)
  2011-02-16  9:17 ` jakub at gcc dot gnu.org
@ 2011-02-16 10:05 ` jakub at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-02-16 10:05 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

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

--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-02-16 09:17:05 UTC ---
Fixed.


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

end of thread, other threads:[~2011-02-16  9:17 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-11 18:52 [Bug c++/47704] New: [4.6 regression] [C++0x] Java-related error message when trying to instantiate a strongly typed enum with new a.chavasse at gmail dot com
2011-02-11 18:55 ` [Bug c++/47704] " redi at gcc dot gnu.org
2011-02-13 17:46 ` jsm28 at gcc dot gnu.org
2011-02-14 12:23 ` jakub at gcc dot gnu.org
2011-02-15 15:59 ` jakub at gcc dot gnu.org
2011-02-15 16:09 ` jakub at gcc dot gnu.org
2011-02-15 16:22 ` jakub at gcc dot gnu.org
2011-02-16  9:17 ` jakub at gcc dot gnu.org
2011-02-16 10:05 ` jakub 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).