public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/53627] New: perfect forwarding for static int member
@ 2012-06-10 20:12 mikhail_semenov at hotmail dot com
2012-06-10 20:29 ` [Bug c++/53627] " paolo.carlini at oracle dot com
` (8 more replies)
0 siblings, 9 replies; 10+ messages in thread
From: mikhail_semenov at hotmail dot com @ 2012-06-10 20:12 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53627
Bug #: 53627
Summary: perfect forwarding for static int member
Classification: Unclassified
Product: gcc
Version: 4.7.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: mikhail_semenov@hotmail.com
Created attachment 27600
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=27600
The program file
The following program fails to link with the ld error report
C:\Users\Mikhail\AppData\Local\Temp\cc0HPRb8.o:perfect_forwarding_for_static_mem
ber.cpp:(.text+0x106): undefined reference to `Z::n'
collect2.exe: error: ld returned 1 exit status
#include <iostream>
#include <string>
#include <memory.h>
struct Z
{
static const double x;
static double y;
static const int n = 1000;
const double p;
Z():p(0.1){};
};
const double Z::x = 33.2;
double Z::y = 55.7;
void a(double d)
{
std::cout << "a(double): " << d << std::endl;
}
void a(int k)
{
std::cout << "a(int): " << k << std::endl;
}
template<class T>
void call(T&& x)
{
a(std::forward<T>(x));
}
int main()
{
int i = 10;
double x = 7.5;
static const double y = 2278.1;
a(i);
a(x);
a(y);
call(Z::x);
call(Z::y);
call(Z().p);
call(Z::n);
return 0;
}
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/53627] perfect forwarding for static int member
2012-06-10 20:12 [Bug c++/53627] New: perfect forwarding for static int member mikhail_semenov at hotmail dot com
@ 2012-06-10 20:29 ` paolo.carlini at oracle dot com
2012-06-10 21:03 ` manu at gcc dot gnu.org
` (7 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: paolo.carlini at oracle dot com @ 2012-06-10 20:29 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53627
Paolo Carlini <paolo.carlini at oracle dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
--- Comment #1 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-06-10 20:29:16 UTC ---
You are missing a definition of n:
const int Z::n;
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/53627] perfect forwarding for static int member
2012-06-10 20:12 [Bug c++/53627] New: perfect forwarding for static int member mikhail_semenov at hotmail dot com
2012-06-10 20:29 ` [Bug c++/53627] " paolo.carlini at oracle dot com
@ 2012-06-10 21:03 ` manu at gcc dot gnu.org
2012-06-10 21:11 ` daniel.kruegler at googlemail dot com
` (6 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: manu at gcc dot gnu.org @ 2012-06-10 21:03 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53627
Manuel López-Ibáñez <manu at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |manu at gcc dot gnu.org
--- Comment #2 from Manuel López-Ibáñez <manu at gcc dot gnu.org> 2012-06-10 21:03:16 UTC ---
This is exactly:
http://gcc.gnu.org/wiki/VerboseDiagnostics#missing_static_const_definition
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/53627] perfect forwarding for static int member
2012-06-10 20:12 [Bug c++/53627] New: perfect forwarding for static int member mikhail_semenov at hotmail dot com
2012-06-10 20:29 ` [Bug c++/53627] " paolo.carlini at oracle dot com
2012-06-10 21:03 ` manu at gcc dot gnu.org
@ 2012-06-10 21:11 ` daniel.kruegler at googlemail dot com
2012-06-10 21:23 ` daniel.kruegler at googlemail dot com
` (5 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: daniel.kruegler at googlemail dot com @ 2012-06-10 21:11 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53627
--- Comment #3 from Daniel Krügler <daniel.kruegler at googlemail dot com> 2012-06-10 21:11:41 UTC ---
This does not look like a compiler defect to me. Z::n has never been defined
but is odr-used.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/53627] perfect forwarding for static int member
2012-06-10 20:12 [Bug c++/53627] New: perfect forwarding for static int member mikhail_semenov at hotmail dot com
` (2 preceding siblings ...)
2012-06-10 21:11 ` daniel.kruegler at googlemail dot com
@ 2012-06-10 21:23 ` daniel.kruegler at googlemail dot com
2012-06-10 21:26 ` daniel.kruegler at googlemail dot com
` (4 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: daniel.kruegler at googlemail dot com @ 2012-06-10 21:23 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53627
Daniel Krügler <daniel.kruegler at googlemail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |daniel.kruegler at
| |googlemail dot com
--- Comment #4 from Daniel Krügler <daniel.kruegler at googlemail dot com> 2012-06-10 21:23:05 UTC ---
(In reply to comment #2)
> This is exactly:
>
> http://gcc.gnu.org/wiki/VerboseDiagnostics#missing_static_const_definition
I agree. But let me just add that the first of the examples provided there
("return argc > 1 ? S::a : S::b;") should no longer me listed (or be modified),
because that was fixed with C++11 due to
http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#712
This situation should no longer require a definition for S::a or S::b.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/53627] perfect forwarding for static int member
2012-06-10 20:12 [Bug c++/53627] New: perfect forwarding for static int member mikhail_semenov at hotmail dot com
` (3 preceding siblings ...)
2012-06-10 21:23 ` daniel.kruegler at googlemail dot com
@ 2012-06-10 21:26 ` daniel.kruegler at googlemail dot com
2012-06-10 21:37 ` redi at gcc dot gnu.org
` (3 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: daniel.kruegler at googlemail dot com @ 2012-06-10 21:26 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53627
--- Comment #5 from Daniel Krügler <daniel.kruegler at googlemail dot com> 2012-06-10 21:26:27 UTC ---
(In reply to comment #4)
> (In reply to comment #2)
> > This is exactly:
> >
> > http://gcc.gnu.org/wiki/VerboseDiagnostics#missing_static_const_definition
>
> I agree. But let me just add that the first of the examples provided there
> ("return argc > 1 ? S::a : S::b;") should no longer me listed (or be modified),
> because that was fixed with C++11 due to
>
> http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#712
>
> This situation should no longer require a definition for S::a or S::b.
I just recognize that this example *does* require a definition for S::a and
S::b in C++11 mode. I open a new issue for this.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/53627] perfect forwarding for static int member
2012-06-10 20:12 [Bug c++/53627] New: perfect forwarding for static int member mikhail_semenov at hotmail dot com
` (4 preceding siblings ...)
2012-06-10 21:26 ` daniel.kruegler at googlemail dot com
@ 2012-06-10 21:37 ` redi at gcc dot gnu.org
2012-06-10 21:50 ` redi at gcc dot gnu.org
` (2 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: redi at gcc dot gnu.org @ 2012-06-10 21:37 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53627
--- Comment #6 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-06-10 21:37:38 UTC ---
I've updated the wiki with words to that effect
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/53627] perfect forwarding for static int member
2012-06-10 20:12 [Bug c++/53627] New: perfect forwarding for static int member mikhail_semenov at hotmail dot com
` (5 preceding siblings ...)
2012-06-10 21:37 ` redi at gcc dot gnu.org
@ 2012-06-10 21:50 ` redi at gcc dot gnu.org
2012-06-11 6:48 ` daniel.kruegler at googlemail dot com
2012-06-11 6:48 ` daniel.kruegler at googlemail dot com
8 siblings, 0 replies; 10+ messages in thread
From: redi at gcc dot gnu.org @ 2012-06-10 21:50 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53627
--- Comment #7 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-06-10 21:50:18 UTC ---
(In reply to comment #4)
> because that was fixed with C++11 due to
>
> http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#712
>
> This situation should no longer require a definition for S::a or S::b.
Unless I'm mistaken DR 712 was not fixed in time for C++11, I don't see it in
N3290
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/53627] perfect forwarding for static int member
2012-06-10 20:12 [Bug c++/53627] New: perfect forwarding for static int member mikhail_semenov at hotmail dot com
` (6 preceding siblings ...)
2012-06-10 21:50 ` redi at gcc dot gnu.org
@ 2012-06-11 6:48 ` daniel.kruegler at googlemail dot com
2012-06-11 6:48 ` daniel.kruegler at googlemail dot com
8 siblings, 0 replies; 10+ messages in thread
From: daniel.kruegler at googlemail dot com @ 2012-06-11 6:48 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53627
--- Comment #8 from Daniel Krügler <daniel.kruegler at googlemail dot com> 2012-06-11 06:47:42 UTC ---
(In reply to comment #7)
> (In reply to comment #4)
> > because that was fixed with C++11 due to
> >
> > http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#712
> >
> > This situation should no longer require a definition for S::a or S::b.
>
> Unless I'm mistaken DR 712 was not fixed in time for C++11, I don't see it in
> N3290
Agreed, DR 712 is a post-C11 resolution.
--- Comment #9 from Daniel Krügler <daniel.kruegler at googlemail dot com> 2012-06-11 06:48:13 UTC ---
(In reply to comment #7)
> (In reply to comment #4)
> > because that was fixed with C++11 due to
> >
> > http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#712
> >
> > This situation should no longer require a definition for S::a or S::b.
>
> Unless I'm mistaken DR 712 was not fixed in time for C++11, I don't see it in
> N3290
Agreed, DR 712 is a post-C++11 resolution.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/53627] perfect forwarding for static int member
2012-06-10 20:12 [Bug c++/53627] New: perfect forwarding for static int member mikhail_semenov at hotmail dot com
` (7 preceding siblings ...)
2012-06-11 6:48 ` daniel.kruegler at googlemail dot com
@ 2012-06-11 6:48 ` daniel.kruegler at googlemail dot com
8 siblings, 0 replies; 10+ messages in thread
From: daniel.kruegler at googlemail dot com @ 2012-06-11 6:48 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53627
--- Comment #8 from Daniel Krügler <daniel.kruegler at googlemail dot com> 2012-06-11 06:47:42 UTC ---
(In reply to comment #7)
> (In reply to comment #4)
> > because that was fixed with C++11 due to
> >
> > http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#712
> >
> > This situation should no longer require a definition for S::a or S::b.
>
> Unless I'm mistaken DR 712 was not fixed in time for C++11, I don't see it in
> N3290
Agreed, DR 712 is a post-C11 resolution.
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2012-06-11 6:48 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-10 20:12 [Bug c++/53627] New: perfect forwarding for static int member mikhail_semenov at hotmail dot com
2012-06-10 20:29 ` [Bug c++/53627] " paolo.carlini at oracle dot com
2012-06-10 21:03 ` manu at gcc dot gnu.org
2012-06-10 21:11 ` daniel.kruegler at googlemail dot com
2012-06-10 21:23 ` daniel.kruegler at googlemail dot com
2012-06-10 21:26 ` daniel.kruegler at googlemail dot com
2012-06-10 21:37 ` redi at gcc dot gnu.org
2012-06-10 21:50 ` redi at gcc dot gnu.org
2012-06-11 6:48 ` daniel.kruegler at googlemail dot com
2012-06-11 6:48 ` daniel.kruegler at googlemail dot com
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).