public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/20098] New: Unresolved dependent "static const" symbol in template
@ 2005-02-20 13:00 wwieser at gmx dot de
2005-02-20 13:03 ` [Bug c++/20098] " pinskia at gcc dot gnu dot org
` (7 more replies)
0 siblings, 8 replies; 9+ messages in thread
From: wwieser at gmx dot de @ 2005-02-20 13:00 UTC (permalink / raw)
To: gcc-bugs
Compiling the following code with gcc-4.0.0 (20050219), (ld-2.15)
will result in an error at link time complaining about all_set being
an unresolved symbol. This is a regression compared to the version some
weeks ago.
-----------------------------------------------------------
template<typename T>struct A
{
static const T all_clr = T(0);
static const T all_set = ~all_clr;
};
int main()
{
A<int> bf;
return(bf.all_set);
}
-----------------------------------------------------------
--
Summary: Unresolved dependent "static const" symbol in template
Product: gcc
Version: 4.0.0
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: wwieser at gmx dot de
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: i686-linux-gnu
GCC host triplet: i686-linux-gnu
GCC target triplet: i686-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20098
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/20098] Unresolved dependent "static const" symbol in template
2005-02-20 13:00 [Bug c++/20098] New: Unresolved dependent "static const" symbol in template wwieser at gmx dot de
@ 2005-02-20 13:03 ` pinskia at gcc dot gnu dot org
2005-02-20 13:34 ` wwieser at gmx dot de
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-02-20 13:03 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2005-02-20 00:12 -------
Note the testcase is invalid code, this is only a missed optimization.
--
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |missed-optimization
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20098
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/20098] Unresolved dependent "static const" symbol in template
2005-02-20 13:00 [Bug c++/20098] New: Unresolved dependent "static const" symbol in template wwieser at gmx dot de
2005-02-20 13:03 ` [Bug c++/20098] " pinskia at gcc dot gnu dot org
2005-02-20 13:34 ` wwieser at gmx dot de
@ 2005-02-20 13:34 ` wwieser at gmx dot de
2005-02-20 13:35 ` pinskia at gcc dot gnu dot org
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: wwieser at gmx dot de @ 2005-02-20 13:34 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From wwieser at gmx dot de 2005-02-20 00:31 -------
Subject: Re: Unresolved dependent "static const" symbol in template
Thanks for a REALLY quick reply!
template<typename T>struct A
{
static const T all_clr = T(0);
static const T all_set = ~all_clr;
};
int main()
{
A<int> bf;
return(bf.all_set);
}
On Sunday 20 February 2005 01:12, pinskia at gcc dot gnu dot org wrote:
> Note the testcase is invalid code,
>
Could you please elaborate on what exactly is invalid?
> this is only a missed optimization.
>
(?? - The unresolved symbol is independent of the optimization level.)
Regards,
Wolfgang
------- Additional Comments From wwieser at gmx dot de 2005-02-20 00:31 -------
Subject: Re: Unresolved dependent "static const" symbol in template
Thanks for a REALLY quick reply!
template<typename T>struct A
{
static const T all_clr = T(0);
static const T all_set = ~all_clr;
};
int main()
{
A<int> bf;
return(bf.all_set);
}
On Sunday 20 February 2005 01:12, pinskia at gcc dot gnu dot org wrote:
> Note the testcase is invalid code,
>
Could you please elaborate on what exactly is invalid?
> this is only a missed optimization.
>
(?? - The unresolved symbol is independent of the optimization level.)
Regards,
Wolfgang
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20098
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/20098] Unresolved dependent "static const" symbol in template
2005-02-20 13:00 [Bug c++/20098] New: Unresolved dependent "static const" symbol in template wwieser at gmx dot de
2005-02-20 13:03 ` [Bug c++/20098] " pinskia at gcc dot gnu dot org
@ 2005-02-20 13:34 ` wwieser at gmx dot de
2005-02-20 13:34 ` wwieser at gmx dot de
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: wwieser at gmx dot de @ 2005-02-20 13:34 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From wwieser at gmx dot de 2005-02-20 00:31 -------
Subject: Re: Unresolved dependent "static const" symbol in template
Thanks for a REALLY quick reply!
template<typename T>struct A
{
static const T all_clr = T(0);
static const T all_set = ~all_clr;
};
int main()
{
A<int> bf;
return(bf.all_set);
}
On Sunday 20 February 2005 01:12, pinskia at gcc dot gnu dot org wrote:
> Note the testcase is invalid code,
>
Could you please elaborate on what exactly is invalid?
> this is only a missed optimization.
>
(?? - The unresolved symbol is independent of the optimization level.)
Regards,
Wolfgang
------- Additional Comments From wwieser at gmx dot de 2005-02-20 00:31 -------
Subject: Re: Unresolved dependent "static const" symbol in template
Thanks for a REALLY quick reply!
template<typename T>struct A
{
static const T all_clr = T(0);
static const T all_set = ~all_clr;
};
int main()
{
A<int> bf;
return(bf.all_set);
}
On Sunday 20 February 2005 01:12, pinskia at gcc dot gnu dot org wrote:
> Note the testcase is invalid code,
>
Could you please elaborate on what exactly is invalid?
> this is only a missed optimization.
>
(?? - The unresolved symbol is independent of the optimization level.)
Regards,
Wolfgang
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20098
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/20098] Unresolved dependent "static const" symbol in template
2005-02-20 13:00 [Bug c++/20098] New: Unresolved dependent "static const" symbol in template wwieser at gmx dot de
` (2 preceding siblings ...)
2005-02-20 13:34 ` wwieser at gmx dot de
@ 2005-02-20 13:35 ` pinskia at gcc dot gnu dot org
2005-02-20 14:12 ` wwieser at gmx dot de
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-02-20 13:35 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2005-02-20 00:34 -------
(In reply to comment #3)
> Subject: Re: Unresolved dependent "static const" symbol in template
>
> Thanks for a REALLY quick reply!
>
> template<typename T>struct A
> {
> static const T all_clr = T(0);
> static const T all_set = ~all_clr;
> };
>
> int main()
> {
> A<int> bf;
>
> return(bf.all_set);
> }
>
> On Sunday 20 February 2005 01:12, pinskia at gcc dot gnu dot org wrote:
> > Note the testcase is invalid code,
> >
> Could you please elaborate on what exactly is invalid?
Yes you need to have declare the storage for the static variables (even though they are constant you still
need the storage area, for an example if you take the address of the variable where is the storage of the
variable if you have not declared it).
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20098
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/20098] Unresolved dependent "static const" symbol in template
2005-02-20 13:00 [Bug c++/20098] New: Unresolved dependent "static const" symbol in template wwieser at gmx dot de
` (3 preceding siblings ...)
2005-02-20 13:35 ` pinskia at gcc dot gnu dot org
@ 2005-02-20 14:12 ` wwieser at gmx dot de
2005-02-21 21:12 ` reichelt at gcc dot gnu dot org
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: wwieser at gmx dot de @ 2005-02-20 14:12 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From wwieser at gmx dot de 2005-02-20 00:49 -------
Subject: Re: Unresolved dependent "static const" symbol in template
On Sunday 20 February 2005 01:34, pinskia at gcc dot gnu dot org wrote:
> Yes you need to have declare the storage for the static variables (even
> though they are constant you still need the storage area, for an example if
> you take the address of the variable where is the storage of the variable
> if you have not declared it).
>
Thanks for pointing out.
Then I agree that it is a missed optimization which previous versions
from 3.4 up to some weeks ago in 4.0 still were able to perform.
Wolfgang
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20098
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/20098] Unresolved dependent "static const" symbol in template
2005-02-20 13:00 [Bug c++/20098] New: Unresolved dependent "static const" symbol in template wwieser at gmx dot de
` (4 preceding siblings ...)
2005-02-20 14:12 ` wwieser at gmx dot de
@ 2005-02-21 21:12 ` reichelt at gcc dot gnu dot org
2005-02-22 0:55 ` [Bug c++/20098] [4.0 Regression] Missed optimization with static const and templates pinskia at gcc dot gnu dot org
2005-02-23 14:14 ` mmitchel at gcc dot gnu dot org
7 siblings, 0 replies; 9+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2005-02-21 21:12 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From reichelt at gcc dot gnu dot org 2005-02-21 13:14 -------
Here's chapter and verse from the standard.
[9.4.2]/4 aka [class.static.data]/4:
If a static data member is of const integral or const enumeration type,
its declaration in the class definition can specify a constant-initializer
which shall be an integral constant expression (5.19). In that case, the
member can appear in integral constant expressions within its scope.
The member shall still be defined in a namespace scope if it is used in
the program and the namespace scope definition shall not contain an
initializer.
--
What |Removed |Added
----------------------------------------------------------------------------
CC| |reichelt at gcc dot gnu dot
| |org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20098
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/20098] [4.0 Regression] Missed optimization with static const and templates
2005-02-20 13:00 [Bug c++/20098] New: Unresolved dependent "static const" symbol in template wwieser at gmx dot de
` (5 preceding siblings ...)
2005-02-21 21:12 ` reichelt at gcc dot gnu dot org
@ 2005-02-22 0:55 ` pinskia at gcc dot gnu dot org
2005-02-23 14:14 ` mmitchel at gcc dot gnu dot org
7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-02-22 0:55 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2005-02-21 21:40 -------
It was broken sinece at least 20050201.
It worked with 20050113.
Confirmed, a missed optimization regression.
--
What |Removed |Added
----------------------------------------------------------------------------
Severity|normal |minor
Status|UNCONFIRMED |NEW
Ever Confirmed| |1
Priority|P2 |P3
Last reconfirmed|0000-00-00 00:00:00 |2005-02-21 21:40:51
date| |
Summary|Unresolved dependent "static|[4.0 Regression] Missed
|const" symbol in template |optimization with static
| |const and templates
Target Milestone|--- |4.0.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20098
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/20098] [4.0 Regression] Missed optimization with static const and templates
2005-02-20 13:00 [Bug c++/20098] New: Unresolved dependent "static const" symbol in template wwieser at gmx dot de
` (6 preceding siblings ...)
2005-02-22 0:55 ` [Bug c++/20098] [4.0 Regression] Missed optimization with static const and templates pinskia at gcc dot gnu dot org
@ 2005-02-23 14:14 ` mmitchel at gcc dot gnu dot org
7 siblings, 0 replies; 9+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2005-02-23 14:14 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From mmitchel at gcc dot gnu dot org 2005-02-23 07:01 -------
This has been fixed -- probably by the patch for either 19883 or 19991.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20098
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2005-02-23 7:01 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-02-20 13:00 [Bug c++/20098] New: Unresolved dependent "static const" symbol in template wwieser at gmx dot de
2005-02-20 13:03 ` [Bug c++/20098] " pinskia at gcc dot gnu dot org
2005-02-20 13:34 ` wwieser at gmx dot de
2005-02-20 13:34 ` wwieser at gmx dot de
2005-02-20 13:35 ` pinskia at gcc dot gnu dot org
2005-02-20 14:12 ` wwieser at gmx dot de
2005-02-21 21:12 ` reichelt at gcc dot gnu dot org
2005-02-22 0:55 ` [Bug c++/20098] [4.0 Regression] Missed optimization with static const and templates pinskia at gcc dot gnu dot org
2005-02-23 14:14 ` mmitchel 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).