public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/21835] New: compilation of CRTP fails if the ABC is after template
@ 2005-05-31  8:42 maierkom at rcs dot ei dot tum dot de
  2005-05-31 13:23 ` [Bug c++/21835] " pinskia at gcc dot gnu dot org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: maierkom at rcs dot ei dot tum dot de @ 2005-05-31  8:42 UTC (permalink / raw)
  To: gcc-bugs

the compilation of a curious recuring template fails if the base class for the
instantiation of the curious recuring template pattern (CRTP) is defined after
the template but before its instantiation.

The following code demonstrates the problem. If uncommenting the outcommented
section and commenting out the latter appearance of the same code, it compiles
successfully.

#include <iostream>

using namespace std;

/*
struct Client
{
	void visit(const class A &a)
	{ cout << "Client::visit(const A &)" << endl; }
};

struct MYABC
{
	virtual void runVisitor(class Client &) const = 0;
};
*/

template <class Derived, class ABC>
struct Door : public ABC
{
	Door()
	: ABC()
	{ }

	void runVisitor(class Client &) const;
};

template <class Derived, class ABC>
void Door<Derived,ABC>::runVisitor(class Client &c) const
{ c.visit(static_cast<const Derived &>(*this)); }

struct Client
{
	void visit(const class A &a)
	{ cout << "Client::visit(const A &)" << endl; }
};

struct MYABC
{
	virtual void runVisitor(class Client &) const = 0;
};

struct A : public Door<A,MYABC>
{
};

-- 
           Summary: compilation of CRTP fails if the ABC is after template
           Product: gcc
           Version: 3.4.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: maierkom at rcs dot ei dot tum dot de
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: sparc-sun-solaris2.8
  GCC host triplet: sparc-sun-solaris2.8
GCC target triplet: sparc-sun-solaris2.8


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


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

* [Bug c++/21835] compilation of CRTP fails if the ABC is after template
  2005-05-31  8:42 [Bug c++/21835] New: compilation of CRTP fails if the ABC is after template maierkom at rcs dot ei dot tum dot de
@ 2005-05-31 13:23 ` pinskia at gcc dot gnu dot org
  2005-05-31 17:11 ` pinskia at gcc dot gnu dot org
  2005-06-19 14:32 ` pinskia at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-05-31 13:23 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |rejects-valid
      Known to fail|                            |3.4.0 3.3.3 3.0.4 2.95.3
      Known to work|                            |4.1.0


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


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

* [Bug c++/21835] compilation of CRTP fails if the ABC is after template
  2005-05-31  8:42 [Bug c++/21835] New: compilation of CRTP fails if the ABC is after template maierkom at rcs dot ei dot tum dot de
  2005-05-31 13:23 ` [Bug c++/21835] " pinskia at gcc dot gnu dot org
@ 2005-05-31 17:11 ` pinskia at gcc dot gnu dot org
  2005-06-19 14:32 ` pinskia at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-05-31 17:11 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
  GCC build triplet|sparc-sun-solaris2.8        |
   GCC host triplet|sparc-sun-solaris2.8        |
 GCC target triplet|sparc-sun-solaris2.8        |


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


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

* [Bug c++/21835] compilation of CRTP fails if the ABC is after template
  2005-05-31  8:42 [Bug c++/21835] New: compilation of CRTP fails if the ABC is after template maierkom at rcs dot ei dot tum dot de
  2005-05-31 13:23 ` [Bug c++/21835] " pinskia at gcc dot gnu dot org
  2005-05-31 17:11 ` pinskia at gcc dot gnu dot org
@ 2005-06-19 14:32 ` pinskia at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-06-19 14:32 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-06-19 14:32 -------
Fixed on the mainline (for 4.1.0), since this is not a regression, I am closing as fixed.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
      Known to fail|3.4.0 3.3.3 3.0.4 2.95.3    |3.4.0 3.3.3 3.0.4 2.95.3
                   |                            |4.0.0
         Resolution|                            |FIXED
   Target Milestone|---                         |4.1.0


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


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

end of thread, other threads:[~2005-06-19 14:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-05-31  8:42 [Bug c++/21835] New: compilation of CRTP fails if the ABC is after template maierkom at rcs dot ei dot tum dot de
2005-05-31 13:23 ` [Bug c++/21835] " pinskia at gcc dot gnu dot org
2005-05-31 17:11 ` pinskia at gcc dot gnu dot org
2005-06-19 14:32 ` pinskia 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).