public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/34238]  New: "static data member used, but not defined" error on member definition
@ 2007-11-26 17:18 bero at arklinux dot org
  2007-11-26 17:19 ` [Bug c++/34238] " bero at arklinux dot org
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: bero at arklinux dot org @ 2007-11-26 17:18 UTC (permalink / raw)
  To: gcc-bugs

Trying to compile the attached preprocessed code (from WebKit) results in

../../../JavaScriptCore/wtf/HashTraits.h:61: error: static data member
'WTF::GenericHashTraitsBase<false, const
WebCore::<unnamed>::CommandImp*>::emptyValueIsZero' used, but not defined
../../../JavaScriptCore/wtf/HashTraits.h:62: error: static data member
'WTF::GenericHashTraitsBase<false, const
WebCore::<unnamed>::CommandImp*>::needsDestruction' used, but not defined
../../../JavaScriptCore/wtf/HashTraits.h:114: error: static data member
'WTF::HashTraits<const WebCore::<unnamed>::CommandImp*>::emptyValueIsZero'
used, but not defined
../../../JavaScriptCore/wtf/HashTraits.h:115: error: static data member
'WTF::HashTraits<const WebCore::<unnamed>::CommandImp*>::needsDestruction'
used, but not defined
../../../JavaScriptCore/wtf/HashTraits.h:61: error: static data member
'WTF::GenericHashTraitsBase<false, std::pair<WebCore::StringImpl*, const
WebCore::<unnamed>::CommandImp*> >::emptyValueIsZero' used, but not defined
../../../JavaScriptCore/wtf/HashTraits.h:62: error: static data member
'WTF::GenericHashTraitsBase<false, std::pair<WebCore::StringImpl*, const
WebCore::<unnamed>::CommandImp*> >::needsDestruction' used, but not defined
../../../JavaScriptCore/wtf/HashTraits.h:67: error: static data member
'WTF::GenericHashTraits<std::pair<WebCore::StringImpl*, const
WebCore::<unnamed>::CommandImp*> >::needsRef' used, but not defined
../../../JavaScriptCore/wtf/HashTraits.h:165: error: static data member
'WTF::PairBaseHashTraits<WTF::HashTraits<WebCore::StringImpl*>,
WTF::HashTraits<const WebCore::<unnamed>::CommandImp*> >::emptyValueIsZero'
used, but not defined



The lines where gcc complains about "static data member used, but not defined"
are actually the places where the members are defined.


-- 
           Summary: "static data member used, but not defined" error on
                    member definition
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: bero at arklinux dot org
 GCC build triplet: i586-pc-linux-gnu
  GCC host triplet: i586-pc-linux-gnu
GCC target triplet: i586-pc-linux-gnu


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


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

* [Bug c++/34238] "static data member used, but not defined" error on member definition
  2007-11-26 17:18 [Bug c++/34238] New: "static data member used, but not defined" error on member definition bero at arklinux dot org
@ 2007-11-26 17:19 ` bero at arklinux dot org
  2007-11-26 20:18 ` jakub at gcc dot gnu dot org
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: bero at arklinux dot org @ 2007-11-26 17:19 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from bero at arklinux dot org  2007-11-26 17:19 -------
Created an attachment (id=14642)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=14642&action=view)
bzip2-ed preprocessed source


-- 


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


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

* [Bug c++/34238] "static data member used, but not defined" error on member definition
  2007-11-26 17:18 [Bug c++/34238] New: "static data member used, but not defined" error on member definition bero at arklinux dot org
  2007-11-26 17:19 ` [Bug c++/34238] " bero at arklinux dot org
@ 2007-11-26 20:18 ` jakub at gcc dot gnu dot org
  2007-11-26 20:26 ` [Bug c++/34238] [4.3 regression] " bero at arklinux dot org
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu dot org @ 2007-11-26 20:18 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from jakub at gcc dot gnu dot org  2007-11-26 20:18 -------
Small testcase:
// PR c++/34238
// { dg-do compile }

namespace
{
  template <typename T = int> struct A
  {
    static const bool a = true;
  };
};
struct A<> a;

Investigating...


-- 

jakub at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |jakub at gcc dot gnu dot org
                   |dot org                     |
             Status|UNCONFIRMED                 |ASSIGNED
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2007-11-26 20:18:10
               date|                            |


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


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

* [Bug c++/34238] [4.3 regression] "static data member used, but not defined" error on member definition
  2007-11-26 17:18 [Bug c++/34238] New: "static data member used, but not defined" error on member definition bero at arklinux dot org
  2007-11-26 17:19 ` [Bug c++/34238] " bero at arklinux dot org
  2007-11-26 20:18 ` jakub at gcc dot gnu dot org
@ 2007-11-26 20:26 ` bero at arklinux dot org
  2007-11-26 20:32 ` pinskia at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: bero at arklinux dot org @ 2007-11-26 20:26 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from bero at arklinux dot org  2007-11-26 20:26 -------
Works in 4.2.x -- marking as regression


-- 

bero at arklinux dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to fail|                            |4.2.0 4.2.1 4.2.2
      Known to work|                            |4.3.0
            Summary|"static data member used,   |[4.3 regression] "static
                   |but not defined" error on   |data member used, but not
                   |member definition           |defined" error on member
                   |                            |definition


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


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

* [Bug c++/34238] [4.3 regression] "static data member used, but not defined" error on member definition
  2007-11-26 17:18 [Bug c++/34238] New: "static data member used, but not defined" error on member definition bero at arklinux dot org
                   ` (2 preceding siblings ...)
  2007-11-26 20:26 ` [Bug c++/34238] [4.3 regression] " bero at arklinux dot org
@ 2007-11-26 20:32 ` pinskia at gcc dot gnu dot org
  2007-11-28  8:03 ` pinskia at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-11-26 20:32 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from pinskia at gcc dot gnu dot org  2007-11-26 20:32 -------
(In reply to comment #2)
> Small testcase:
> // PR c++/34238
> // { dg-do compile }
> namespace
> {
>   template <typename T = int> struct A
>   {
>     static const bool a = true;
>   };
> };
> struct A<> a;

Hmm, I think this is invalid code.  There is no definition of A<T>::a, though
there is no use of A<T>::a.


-- 

pinskia at gcc dot gnu dot org changed:

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


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


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

* [Bug c++/34238] [4.3 regression] "static data member used, but not defined" error on member definition
  2007-11-26 17:18 [Bug c++/34238] New: "static data member used, but not defined" error on member definition bero at arklinux dot org
                   ` (3 preceding siblings ...)
  2007-11-26 20:32 ` pinskia at gcc dot gnu dot org
@ 2007-11-28  8:03 ` pinskia at gcc dot gnu dot org
  2007-11-29 11:00 ` rguenth at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-11-28  8:03 UTC (permalink / raw)
  To: gcc-bugs



-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.3.0


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


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

* [Bug c++/34238] [4.3 regression] "static data member used, but not defined" error on member definition
  2007-11-26 17:18 [Bug c++/34238] New: "static data member used, but not defined" error on member definition bero at arklinux dot org
                   ` (4 preceding siblings ...)
  2007-11-28  8:03 ` pinskia at gcc dot gnu dot org
@ 2007-11-29 11:00 ` rguenth at gcc dot gnu dot org
  2007-11-29 11:07 ` jakub at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2007-11-29 11:00 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from rguenth at gcc dot gnu dot org  2007-11-29 11:00 -------
Yes, this looks invalid - but can we diagnose this at compile-time?

Also, from decl2.c:

              /* Error on
                 namespace { struct A { static int i; }; }
                 int foo () { return A::i; }
                 without A::i definition (which can't be defined in
                 a different CU because of the anonymous namespace).
                 Don't do this if DECL_INITIAL is set, because for
                 namespace { struct A { static const int i = 4; } };
                 decl_needed_p won't reliably detect whether it was
                 really needed.  */
              if (DECL_IN_AGGR_P (decl) && DECL_INITIAL (decl) == NULL_TREE)
                error ("%Jstatic data member %qD used, but not defined",
                       decl, decl);

it suggests that we do not want to error in this case.  But for some reason
we do not have DECL_INITIAL set for a, but only in its
template_decl->DECL_TEMPLATE_RESULT we can find it.


-- 

rguenth at gcc dot gnu dot org changed:

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


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


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

* [Bug c++/34238] [4.3 regression] "static data member used, but not defined" error on member definition
  2007-11-26 17:18 [Bug c++/34238] New: "static data member used, but not defined" error on member definition bero at arklinux dot org
                   ` (5 preceding siblings ...)
  2007-11-29 11:00 ` rguenth at gcc dot gnu dot org
@ 2007-11-29 11:07 ` jakub at gcc dot gnu dot org
  2007-12-03  3:16 ` pinskia 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 @ 2007-11-29 11:07 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from jakub at gcc dot gnu dot org  2007-11-29 11:07 -------
Fix has been already posted 3 days ago:
http://gcc.gnu.org/ml/gcc-patches/2007-11/msg01419.html


-- 

jakub at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                URL|                            |http://gcc.gnu.org/ml/gcc-
                   |                            |patches/2007-
                   |                            |11/msg01419.html


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


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

* [Bug c++/34238] [4.3 regression] "static data member used, but not defined" error on member definition
  2007-11-26 17:18 [Bug c++/34238] New: "static data member used, but not defined" error on member definition bero at arklinux dot org
                   ` (6 preceding siblings ...)
  2007-11-29 11:07 ` jakub at gcc dot gnu dot org
@ 2007-12-03  3:16 ` pinskia at gcc dot gnu dot org
  2007-12-04 22:27 ` rguenth at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-12-03  3:16 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from pinskia at gcc dot gnu dot org  2007-12-03 03:15 -------
*** Bug 34229 has been marked as a duplicate of this bug. ***


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rwgk at yahoo dot com


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


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

* [Bug c++/34238] [4.3 regression] "static data member used, but not defined" error on member definition
  2007-11-26 17:18 [Bug c++/34238] New: "static data member used, but not defined" error on member definition bero at arklinux dot org
                   ` (7 preceding siblings ...)
  2007-12-03  3:16 ` pinskia at gcc dot gnu dot org
@ 2007-12-04 22:27 ` rguenth at gcc dot gnu dot org
  2007-12-11  8:22 ` jakub at gcc dot gnu dot org
  2007-12-11  8:39 ` jakub at gcc dot gnu dot org
  10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2007-12-04 22:27 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from rguenth at gcc dot gnu dot org  2007-12-04 22:26 -------
*** Bug 34340 has been marked as a duplicate of this bug. ***


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rbuergel at web dot de


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


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

* [Bug c++/34238] [4.3 regression] "static data member used, but not defined" error on member definition
  2007-11-26 17:18 [Bug c++/34238] New: "static data member used, but not defined" error on member definition bero at arklinux dot org
                   ` (8 preceding siblings ...)
  2007-12-04 22:27 ` rguenth at gcc dot gnu dot org
@ 2007-12-11  8:22 ` jakub at gcc dot gnu dot org
  2007-12-11  8:39 ` jakub at gcc dot gnu dot org
  10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu dot org @ 2007-12-11  8:22 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from jakub at gcc dot gnu dot org  2007-12-11 08:22 -------
Subject: Bug 34238

Author: jakub
Date: Tue Dec 11 08:22:10 2007
New Revision: 130771

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=130771
Log:
        PR c++/34238
        * decl2.c (cp_write_global_declarations): Revert 2007-11-22 change.

        * g++.dg/ext/visibility/anon7.C: Add xfail.
        * g++.dg/ext/visibility/anon9.C: New test.
        * g++.dg/ext/visibility/anon10.C: New test.

Added:
    trunk/gcc/testsuite/g++.dg/ext/visibility/anon10.C
    trunk/gcc/testsuite/g++.dg/ext/visibility/anon9.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/decl2.c
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/g++.dg/ext/visibility/anon7.C


-- 


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


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

* [Bug c++/34238] [4.3 regression] "static data member used, but not defined" error on member definition
  2007-11-26 17:18 [Bug c++/34238] New: "static data member used, but not defined" error on member definition bero at arklinux dot org
                   ` (9 preceding siblings ...)
  2007-12-11  8:22 ` jakub at gcc dot gnu dot org
@ 2007-12-11  8:39 ` jakub at gcc dot gnu dot org
  10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu dot org @ 2007-12-11  8:39 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #10 from jakub at gcc dot gnu dot org  2007-12-11 08:39 -------
Fixed, at the expense of reverting PR34094 fix.


-- 

jakub at gcc dot gnu dot org changed:

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


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


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

end of thread, other threads:[~2007-12-11  8:39 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-11-26 17:18 [Bug c++/34238] New: "static data member used, but not defined" error on member definition bero at arklinux dot org
2007-11-26 17:19 ` [Bug c++/34238] " bero at arklinux dot org
2007-11-26 20:18 ` jakub at gcc dot gnu dot org
2007-11-26 20:26 ` [Bug c++/34238] [4.3 regression] " bero at arklinux dot org
2007-11-26 20:32 ` pinskia at gcc dot gnu dot org
2007-11-28  8:03 ` pinskia at gcc dot gnu dot org
2007-11-29 11:00 ` rguenth at gcc dot gnu dot org
2007-11-29 11:07 ` jakub at gcc dot gnu dot org
2007-12-03  3:16 ` pinskia at gcc dot gnu dot org
2007-12-04 22:27 ` rguenth at gcc dot gnu dot org
2007-12-11  8:22 ` jakub at gcc dot gnu dot org
2007-12-11  8:39 ` jakub 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).