public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/49176] New: [4.6 Regression][c++0x] valid code rejected with "error: uninitialized const"
@ 2011-05-26 18:04 roman at binarylife dot net
  2011-05-26 19:18 ` [Bug c++/49176] " redi at gcc dot gnu.org
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: roman at binarylife dot net @ 2011-05-26 18:04 UTC (permalink / raw)
  To: gcc-bugs

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

           Summary: [4.6 Regression][c++0x] valid code rejected with
                    "error: uninitialized const"
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: roman@binarylife.net


$ cat test.cpp 
struct A { static int a(); };

template<int>
struct B { static int const b; };

int f() { return B<0>::b; }

template<int I> 
int const B<I>::b=A::a();

$ g++ -c -std=c++0x test.cpp 
test.cpp: In instantiation of ‘const int B<0>::b’:
test.cpp:6:24:   instantiated from here
test.cpp:9:11: error: uninitialized const ‘B<0>::b’ [-fpermissive]


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

* [Bug c++/49176] [4.6 Regression][c++0x] valid code rejected with "error: uninitialized const"
  2011-05-26 18:04 [Bug c++/49176] New: [4.6 Regression][c++0x] valid code rejected with "error: uninitialized const" roman at binarylife dot net
@ 2011-05-26 19:18 ` redi at gcc dot gnu.org
  2011-05-26 20:39 ` roman at binarylife dot net
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: redi at gcc dot gnu.org @ 2011-05-26 19:18 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |fabien at gcc dot gnu.org
      Known to work|                            |4.5.3, 4.7.0
      Known to fail|                            |4.6.0

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> 2011-05-26 19:17:23 UTC ---
are you using 4.6.0 or a build from the 4.6 branch?
(please always state the version in bug reports)

it seems to be fixed in 4.7

Fabien, any ideas?


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

* [Bug c++/49176] [4.6 Regression][c++0x] valid code rejected with "error: uninitialized const"
  2011-05-26 18:04 [Bug c++/49176] New: [4.6 Regression][c++0x] valid code rejected with "error: uninitialized const" roman at binarylife dot net
  2011-05-26 19:18 ` [Bug c++/49176] " redi at gcc dot gnu.org
@ 2011-05-26 20:39 ` roman at binarylife dot net
  2011-05-27  7:59 ` fabien at gcc dot gnu.org
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: roman at binarylife dot net @ 2011-05-26 20:39 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Roman Kononov <roman at binarylife dot net> 2011-05-26 20:15:35 UTC ---
4.6 branch, r174294


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

* [Bug c++/49176] [4.6 Regression][c++0x] valid code rejected with "error: uninitialized const"
  2011-05-26 18:04 [Bug c++/49176] New: [4.6 Regression][c++0x] valid code rejected with "error: uninitialized const" roman at binarylife dot net
  2011-05-26 19:18 ` [Bug c++/49176] " redi at gcc dot gnu.org
  2011-05-26 20:39 ` roman at binarylife dot net
@ 2011-05-27  7:59 ` fabien at gcc dot gnu.org
  2011-05-27  8:55 ` fabien at gcc dot gnu.org
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: fabien at gcc dot gnu.org @ 2011-05-27  7:59 UTC (permalink / raw)
  To: gcc-bugs

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

fabien at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot       |fabien at gcc dot gnu.org
                   |gnu.org                     |

--- Comment #3 from fabien at gcc dot gnu.org 2011-05-27 07:56:43 UTC ---
(In reply to comment #1)
> are you using 4.6.0 or a build from the 4.6 branch?
> (please always state the version in bug reports)
> 
> it seems to be fixed in 4.7
> 
> Fabien, any ideas?

I guess this is caused by my last checkin (rev 174239), which was for 4.6 only.
I'll look into it this afternoon.


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

* [Bug c++/49176] [4.6 Regression][c++0x] valid code rejected with "error: uninitialized const"
  2011-05-26 18:04 [Bug c++/49176] New: [4.6 Regression][c++0x] valid code rejected with "error: uninitialized const" roman at binarylife dot net
                   ` (2 preceding siblings ...)
  2011-05-27  7:59 ` fabien at gcc dot gnu.org
@ 2011-05-27  8:55 ` fabien at gcc dot gnu.org
  2011-05-27  9:01 ` paolo.carlini at oracle dot com
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: fabien at gcc dot gnu.org @ 2011-05-27  8:55 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from fabien at gcc dot gnu.org 2011-05-27 08:23:35 UTC ---
Is it broken in 4.6.0 before r174239 ?


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

* [Bug c++/49176] [4.6 Regression][c++0x] valid code rejected with "error: uninitialized const"
  2011-05-26 18:04 [Bug c++/49176] New: [4.6 Regression][c++0x] valid code rejected with "error: uninitialized const" roman at binarylife dot net
                   ` (3 preceding siblings ...)
  2011-05-27  8:55 ` fabien at gcc dot gnu.org
@ 2011-05-27  9:01 ` paolo.carlini at oracle dot com
  2011-05-27  9:06 ` paolo.carlini at oracle dot com
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: paolo.carlini at oracle dot com @ 2011-05-27  9:01 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Paolo Carlini <paolo.carlini at oracle dot com> 2011-05-27 08:58:27 UTC ---
Just tried -r174238: was already broken.


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

* [Bug c++/49176] [4.6 Regression][c++0x] valid code rejected with "error: uninitialized const"
  2011-05-26 18:04 [Bug c++/49176] New: [4.6 Regression][c++0x] valid code rejected with "error: uninitialized const" roman at binarylife dot net
                   ` (4 preceding siblings ...)
  2011-05-27  9:01 ` paolo.carlini at oracle dot com
@ 2011-05-27  9:06 ` paolo.carlini at oracle dot com
  2011-05-27 16:33 ` fabien at gcc dot gnu.org
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: paolo.carlini at oracle dot com @ 2011-05-27  9:06 UTC (permalink / raw)
  To: gcc-bugs

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

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2011.05.27 09:00:47
     Ever Confirmed|0                           |1


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

* [Bug c++/49176] [4.6 Regression][c++0x] valid code rejected with "error: uninitialized const"
  2011-05-26 18:04 [Bug c++/49176] New: [4.6 Regression][c++0x] valid code rejected with "error: uninitialized const" roman at binarylife dot net
                   ` (5 preceding siblings ...)
  2011-05-27  9:06 ` paolo.carlini at oracle dot com
@ 2011-05-27 16:33 ` fabien at gcc dot gnu.org
  2011-05-27 17:15 ` jason at gcc dot gnu.org
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: fabien at gcc dot gnu.org @ 2011-05-27 16:33 UTC (permalink / raw)
  To: gcc-bugs

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

fabien at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jason at gcc dot gnu.org
         AssignedTo|fabien at gcc dot gnu.org   |unassigned at gcc dot
                   |                            |gnu.org

--- Comment #6 from fabien at gcc dot gnu.org 2011-05-27 16:31:42 UTC ---
(In reply to comment #5)
> Just tried -r174238: was already broken.

Thank you Paolo.

I've just played a little with it, it seems that to avoid the uninitialized
diagnostic from check_for_uninitialized_const_var, the constness of b have to
be removed at some point. It is not removed in c++0X mode for 4.6.
Let's CC Jason ...


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

* [Bug c++/49176] [4.6 Regression][c++0x] valid code rejected with "error: uninitialized const"
  2011-05-26 18:04 [Bug c++/49176] New: [4.6 Regression][c++0x] valid code rejected with "error: uninitialized const" roman at binarylife dot net
                   ` (6 preceding siblings ...)
  2011-05-27 16:33 ` fabien at gcc dot gnu.org
@ 2011-05-27 17:15 ` jason at gcc dot gnu.org
  2011-05-27 18:30 ` jason at gcc dot gnu.org
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: jason at gcc dot gnu.org @ 2011-05-27 17:15 UTC (permalink / raw)
  To: gcc-bugs

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

Jason Merrill <jason at gcc dot gnu.org> changed:

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

--- Comment #7 from Jason Merrill <jason at gcc dot gnu.org> 2011-05-27 17:14:06 UTC ---
Seems like this was fixed by the patch for bug 48657.


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

* [Bug c++/49176] [4.6 Regression][c++0x] valid code rejected with "error: uninitialized const"
  2011-05-26 18:04 [Bug c++/49176] New: [4.6 Regression][c++0x] valid code rejected with "error: uninitialized const" roman at binarylife dot net
                   ` (7 preceding siblings ...)
  2011-05-27 17:15 ` jason at gcc dot gnu.org
@ 2011-05-27 18:30 ` jason at gcc dot gnu.org
  2011-05-27 19:34 ` jason at gcc dot gnu.org
  2011-05-27 21:06 ` jason at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: jason at gcc dot gnu.org @ 2011-05-27 18:30 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from Jason Merrill <jason at gcc dot gnu.org> 2011-05-27 18:10:52 UTC ---
Author: jason
Date: Fri May 27 18:10:48 2011
New Revision: 174346

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=174346
Log:
    PR c++/48657
    PR c++/49176
    * decl.c (cp_finish_decl): Simplify template handling.

Added:
    branches/gcc-4_6-branch/gcc/testsuite/g++.dg/template/const5.C
Modified:
    branches/gcc-4_6-branch/gcc/cp/ChangeLog
    branches/gcc-4_6-branch/gcc/cp/decl.c
    branches/gcc-4_6-branch/gcc/testsuite/ChangeLog


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

* [Bug c++/49176] [4.6 Regression][c++0x] valid code rejected with "error: uninitialized const"
  2011-05-26 18:04 [Bug c++/49176] New: [4.6 Regression][c++0x] valid code rejected with "error: uninitialized const" roman at binarylife dot net
                   ` (8 preceding siblings ...)
  2011-05-27 18:30 ` jason at gcc dot gnu.org
@ 2011-05-27 19:34 ` jason at gcc dot gnu.org
  2011-05-27 21:06 ` jason at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: jason at gcc dot gnu.org @ 2011-05-27 19:34 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #9 from Jason Merrill <jason at gcc dot gnu.org> 2011-05-27 19:32:25 UTC ---
Author: jason
Date: Fri May 27 19:32:22 2011
New Revision: 174356

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=174356
Log:
    PR c++/49176
    * g++.dg/template/const5.C: New.

Added:
    trunk/gcc/testsuite/g++.dg/template/const5.C
Modified:
    trunk/gcc/testsuite/ChangeLog


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

* [Bug c++/49176] [4.6 Regression][c++0x] valid code rejected with "error: uninitialized const"
  2011-05-26 18:04 [Bug c++/49176] New: [4.6 Regression][c++0x] valid code rejected with "error: uninitialized const" roman at binarylife dot net
                   ` (9 preceding siblings ...)
  2011-05-27 19:34 ` jason at gcc dot gnu.org
@ 2011-05-27 21:06 ` jason at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: jason at gcc dot gnu.org @ 2011-05-27 21:06 UTC (permalink / raw)
  To: gcc-bugs

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

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.6.1

--- Comment #10 from Jason Merrill <jason at gcc dot gnu.org> 2011-05-27 20:57:36 UTC ---
Fixed.


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

end of thread, other threads:[~2011-05-27 20:58 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-26 18:04 [Bug c++/49176] New: [4.6 Regression][c++0x] valid code rejected with "error: uninitialized const" roman at binarylife dot net
2011-05-26 19:18 ` [Bug c++/49176] " redi at gcc dot gnu.org
2011-05-26 20:39 ` roman at binarylife dot net
2011-05-27  7:59 ` fabien at gcc dot gnu.org
2011-05-27  8:55 ` fabien at gcc dot gnu.org
2011-05-27  9:01 ` paolo.carlini at oracle dot com
2011-05-27  9:06 ` paolo.carlini at oracle dot com
2011-05-27 16:33 ` fabien at gcc dot gnu.org
2011-05-27 17:15 ` jason at gcc dot gnu.org
2011-05-27 18:30 ` jason at gcc dot gnu.org
2011-05-27 19:34 ` jason at gcc dot gnu.org
2011-05-27 21:06 ` jason 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).