public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/11788] New: [3.4 regression] missing implicit instantiation of static member function
@ 2003-08-04 14:19 reichelt at gcc dot gnu dot org
  2003-08-04 15:05 ` [Bug c++/11788] " pinskia at physics dot uc dot edu
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2003-08-04 14:19 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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

           Summary: [3.4 regression] missing implicit instantiation of
                    static member function
           Product: gcc
           Version: 3.4
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: critical
          Priority: P1
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: reichelt at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org

Consider the following program:

------------------------------------------
template <typename> struct A
{
    static void foo() {}
};

int main()
{
    A<int> a;
    return (int)(&a.foo);
}
------------------------------------------

Compiling this with mainline (since the parser merge) results
in a linker error:

/tmp/ccWTn0Bs.o: In function `main':
/tmp/ccWTn0Bs.o(.text+0x11): undefined reference to `A<int>::foo()'

If I instantiate A<int>::foo explicitly the code compiles.
But IMHO the explicit instantiation isn't mandated.


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

* [Bug c++/11788] [3.4 regression] missing implicit instantiation of static member function
  2003-08-04 14:19 [Bug c++/11788] New: [3.4 regression] missing implicit instantiation of static member function reichelt at gcc dot gnu dot org
@ 2003-08-04 15:05 ` pinskia at physics dot uc dot edu
  2003-08-29 22:03 ` janis187 at us dot ibm dot com
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at physics dot uc dot edu @ 2003-08-04 15:05 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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


pinskia at physics dot uc dot edu changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2003-08-04 15:05:19
               date|                            |


------- Additional Comments From pinskia at physics dot uc dot edu  2003-08-04 15:05 -------
I can confirm this on the mainline (20030804).
Another example:
template <typename> struct A
{
    static void foo() {}
};
typedef void (*a)(void);
a f()
{
    A<int> a;
    return &a.foo;
}
int main()
{
        f()();
        return 0;
}


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

* [Bug c++/11788] [3.4 regression] missing implicit instantiation of static member function
  2003-08-04 14:19 [Bug c++/11788] New: [3.4 regression] missing implicit instantiation of static member function reichelt at gcc dot gnu dot org
  2003-08-04 15:05 ` [Bug c++/11788] " pinskia at physics dot uc dot edu
@ 2003-08-29 22:03 ` janis187 at us dot ibm dot com
  2003-08-30  1:10 ` pinskia at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: janis187 at us dot ibm dot com @ 2003-08-29 22:03 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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



------- Additional Comments From janis187 at us dot ibm dot com  2003-08-29 22:03 -------
The behavior changed with the new C++ parser.


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

* [Bug c++/11788] [3.4 regression] missing implicit instantiation of static member function
  2003-08-04 14:19 [Bug c++/11788] New: [3.4 regression] missing implicit instantiation of static member function reichelt at gcc dot gnu dot org
  2003-08-04 15:05 ` [Bug c++/11788] " pinskia at physics dot uc dot edu
  2003-08-29 22:03 ` janis187 at us dot ibm dot com
@ 2003-08-30  1:10 ` pinskia at gcc dot gnu dot org
  2003-09-06 18:56 ` nathan at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2003-08-30  1:10 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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



------- Additional Comments From pinskia at gcc dot gnu dot org  2003-08-30 01:09 -------
Another example (not implicated declared inline):
template <typename> struct A  {  static void foo(); };
template <typename a1> void A<a1>::foo(){}
typedef void (*a)(void);
a f() {  return &A<int>().foo; }
int main() {   f()();  }


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

* [Bug c++/11788] [3.4 regression] missing implicit instantiation of static member function
  2003-08-04 14:19 [Bug c++/11788] New: [3.4 regression] missing implicit instantiation of static member function reichelt at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2003-08-30  1:10 ` pinskia at gcc dot gnu dot org
@ 2003-09-06 18:56 ` nathan at gcc dot gnu dot org
  2003-09-11 15:22 ` nathan at gcc dot gnu dot org
  2003-09-11 15:26 ` cvs-commit at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: nathan at gcc dot gnu dot org @ 2003-09-06 18:56 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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


nathan at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |nathan at gcc dot gnu dot
                   |dot org                     |org
             Status|NEW                         |ASSIGNED


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

* [Bug c++/11788] [3.4 regression] missing implicit instantiation of static member function
  2003-08-04 14:19 [Bug c++/11788] New: [3.4 regression] missing implicit instantiation of static member function reichelt at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2003-09-06 18:56 ` nathan at gcc dot gnu dot org
@ 2003-09-11 15:22 ` nathan at gcc dot gnu dot org
  2003-09-11 15:26 ` cvs-commit at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: nathan at gcc dot gnu dot org @ 2003-09-11 15:22 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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


nathan at gcc dot gnu dot org changed:

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


------- Additional Comments From nathan at gcc dot gnu dot org  2003-09-11 15:19 -------
2003-09-10  Nathan Sidwell  <nathan@codesourcery.com>

	PR c++/11788
	* typeck.c (build_address): If it is a function, mark it used.
	(build_unary_op): Do not lose object's side-effects when taking
	address of static member function.
	* class.c (resolve_address_of_overloaded_function): Use
	tsubst_flags_t parameter. Only expect overload sets. Adjust.
	(instantiate_type): Adjust flags passing. Do not lose object's
	side-effects when taking address of static member function.


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

* [Bug c++/11788] [3.4 regression] missing implicit instantiation of static member function
  2003-08-04 14:19 [Bug c++/11788] New: [3.4 regression] missing implicit instantiation of static member function reichelt at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2003-09-11 15:22 ` nathan at gcc dot gnu dot org
@ 2003-09-11 15:26 ` cvs-commit at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2003-09-11 15:26 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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



------- Additional Comments From cvs-commit at gcc dot gnu dot org  2003-09-11 15:22 -------
Subject: Bug 11788

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	nathan@gcc.gnu.org	2003-09-11 15:18:53

Modified files:
	gcc/cp         : ChangeLog class.c typeck.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/g++.dg/overload: addr1.C 

Log message:
	cp:
	PR c++/11788
	* typeck.c (build_address): If it is a function, mark it used.
	(build_unary_op): Do not lose object's side-effects when taking
	address of static member function.
	* class.c (resolve_address_of_overloaded_function): Use
	tsubst_flags_t parameter. Only expect overload sets. Adjust.
	(instantiate_type): Adjust flags passing. Do not lose object's
	side-effects when taking address of static member function.
	testsuite:
	PR c++/11788
	* g++.dg/overload/addr1.C: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.3672&r2=1.3673
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/class.c.diff?cvsroot=gcc&r1=1.568&r2=1.569
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/typeck.c.diff?cvsroot=gcc&r1=1.501&r2=1.502
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.3049&r2=1.3050
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/overload/addr1.C.diff?cvsroot=gcc&r1=NONE&r2=1.1


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

end of thread, other threads:[~2003-09-11 15:24 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-08-04 14:19 [Bug c++/11788] New: [3.4 regression] missing implicit instantiation of static member function reichelt at gcc dot gnu dot org
2003-08-04 15:05 ` [Bug c++/11788] " pinskia at physics dot uc dot edu
2003-08-29 22:03 ` janis187 at us dot ibm dot com
2003-08-30  1:10 ` pinskia at gcc dot gnu dot org
2003-09-06 18:56 ` nathan at gcc dot gnu dot org
2003-09-11 15:22 ` nathan at gcc dot gnu dot org
2003-09-11 15:26 ` cvs-commit 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).