public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: c++/2402: Problem with compile-time sizeof evaluation and templates
@ 2002-11-01  6:44 lerdsuwa
  0 siblings, 0 replies; 2+ messages in thread
From: lerdsuwa @ 2002-11-01  6:44 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, nobody, stephen

Synopsis: Problem with compile-time sizeof evaluation and templates

State-Changed-From-To: analyzed->closed
State-Changed-By: lerdsuwa
State-Changed-When: Fri Nov  1 06:44:48 2002
State-Changed-Why:
    Fixed in the main trunk.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=2402


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

* c++/2402: Problem with compile-time sizeof evaluation and templates
@ 2001-03-27  5:46 stephen
  0 siblings, 0 replies; 2+ messages in thread
From: stephen @ 2001-03-27  5:46 UTC (permalink / raw)
  To: gcc-gnats

>Number:         2402
>Category:       c++
>Synopsis:       Problem with compile-time sizeof evaluation and templates
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          rejects-legal
>Submitter-Id:   net
>Arrival-Date:   Tue Mar 27 05:46:03 PST 2001
>Closed-Date:
>Last-Modified:
>Originator:     stephen@bregmasoft.com
>Release:        GNU C++ version 3.1 20010326 (experimental) (i686-pc-linux-gnu)
>Organization:
>Environment:

>Description:
The following well-formed C++ program

// -- begin tu.cpp --
template< class T >
	struct C
	{
		static T returnaT();
		enum { itsSize = sizeof C::returnaT() };
	};

int
main(int argc, char* argv[])
{
	long aSize = C<double>::itsSize;
	return 0;
}
// -- end tu.cpp -

gives the following error on compile (g++ tu.cpp):

tu.cpp: In instantiation of `C<double>':
tu.cpp:13:   instantiated from here
tu.cpp:13: no method `C<double>::returnaT'

Note that (a) there is too a C<double>::returnaT, since it's defined
in the previous line, and (2) it's not Smalltalk, there are no "methods,"
only member functions, so the error message text could be improved
to say what it means.

The problem only occurs with templated classes.  The same code using a non-templated class
compiles OK.

There's a large body of standard-compliant code out there that
relies on this sort of construct working.

This code has never worked with any version of GCC, so it's not a regression.
 
>How-To-Repeat:
See description above.
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


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

end of thread, other threads:[~2002-11-01 14:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-11-01  6:44 c++/2402: Problem with compile-time sizeof evaluation and templates lerdsuwa
  -- strict thread matches above, loose matches on Subject: below --
2001-03-27  5:46 stephen

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