public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "pogonyshev at gmx dot net" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/43368]  New: different access to templated structure static field give different results
Date: Sun, 14 Mar 2010 20:25:00 -0000	[thread overview]
Message-ID: <bug-43368-11205@http.gcc.gnu.org/bugzilla/> (raw)

Tested with Debian testing 4.4.3-3 and 4.3.4-8.

Compiling this code snippet:

template <int& field>
struct Foo
{
  static  int
  bar ()
  {  return field;  }
};

template <bool>
struct X
{
  static  int  x;
  typedef  Foo <x>  foo;
};

// This makes first statement in main() compile, but not the second...
template <>
int  X <false>::x = 0;

int
main ()
{
  X <false>::x;
  X <false>::foo::bar ();
}

with 'g++ test.cpp -o test' gives the following error on linking stage:

/tmp/ccuo8N2e.o: In function `_ZN3FooILZN1XIXT_EE1xEEE3barEv':
test.cpp:(.text._ZN3FooILZN1XIXT_EE1xEEE3barEv[_ZN3FooILZN1XIXT_EE1xEEE3barEv]+0x4):
undefined reference to `_ZN1XIXT_EE1xE'

This is a regression: it works with 4.1, but doesn't with 4.3 or 4.4.  Didn't
test 4.2.


-- 
           Summary: different access to templated structure static field
                    give different results
           Product: gcc
           Version: 4.4.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: pogonyshev at gmx dot net
 GCC build triplet: i486-pc-linux-gnu
  GCC host triplet: i486-pc-linux-gnu
GCC target triplet: i486-pc-linux-gnu


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


             reply	other threads:[~2010-03-14 20:25 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-14 20:25 pogonyshev at gmx dot net [this message]
2010-03-14 23:27 ` [Bug c++/43368] [4.3/4.4/4.5 Regression] " hjl dot tools at gmail dot com
2010-03-15 10:32 ` redi at gcc dot gnu dot org
2010-03-15 11:20 ` rguenth at gcc dot gnu dot org
2010-03-15 12:22 ` redi at gcc dot gnu dot org
2010-03-15 13:20 ` [Bug c++/43368] " rguenth at gcc dot gnu dot org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-43368-11205@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).