public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: a-hw@mail.ru
To: gcc-gnats@gcc.gnu.org
Subject: c++/8860: illegal constructor causes internal compiler error
Date: Sat, 07 Dec 2002 08:16:00 -0000	[thread overview]
Message-ID: <20021207160930.23791.qmail@sources.redhat.com> (raw)


>Number:         8860
>Category:       c++
>Synopsis:       illegal constructor causes internal compiler error
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Dec 07 08:16:00 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     a-hw@mail.ru
>Release:        gcc (GCC) 3.2 (mingw special 20020817-1)
>Organization:
>Environment:
Win2K, MingGW 2.0.0 prebuilt binaries
>Description:
This code causes g++ to feel segmentation fault. I've replaced initializer for base class Smoother(size) with Smoother_Lookup(size):

template<typename Function>
class Smoother_Lookup : public Smoother {
public:
	Smoother_Lookup(int size) : Smoother_Lookup(size), lookup(size) {
		std::generate_n(lookup.begin(), size, Function(size));
	}
	int smooth(int r) { return lookup[r]; }
protected:
	std::vector<int> lookup;
};
>How-To-Repeat:
Try to compile test.cpp:

make test.o
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: text/plain; name="test.cpp"
Content-Disposition: inline; filename="test.cpp"

#include <vector>

class Smoother {
public:
	Smoother(int size) : _size(size) { }
	virtual ~Smoother() = 0;
	virtual int smooth(int r) = 0;
protected:
	int _size;
};

template<typename Function>
class Smoother_Lookup : public Smoother {
public:
	Smoother_Lookup(int size) : Smoother_Lookup(size), lookup(size) {
		std::generate_n(lookup.begin(), size, Function(size));
	}
	int smooth(int r) { return lookup[r]; }
protected:
	std::vector<int> lookup;
};

struct Test {
	int operator()() { return 0; }
};

int
f() {
	Smoother_Lookup<Test> sl(1);
}


             reply	other threads:[~2002-12-07 16:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-12-07  8:16 a-hw [this message]
2002-12-07 13:21 reichelt
2002-12-08  6:46 Alex Kunin

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=20021207160930.23791.qmail@sources.redhat.com \
    --to=a-hw@mail.ru \
    --cc=gcc-gnats@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).