public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/43368]  New: different access to templated structure static field give different results
@ 2010-03-14 20:25 pogonyshev at gmx dot net
  2010-03-14 23:27 ` [Bug c++/43368] [4.3/4.4/4.5 Regression] " hjl dot tools at gmail dot com
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: pogonyshev at gmx dot net @ 2010-03-14 20:25 UTC (permalink / raw)
  To: gcc-bugs

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


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

end of thread, other threads:[~2010-03-15 13:20 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-03-14 20:25 [Bug c++/43368] New: different access to templated structure static field give different results pogonyshev at gmx dot net
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

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).