This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
c++/10223: template trickery causes ICE (segmentation fault)
- From: hg211 at ural2 dot hszk dot bme dot hu
- To: gcc-gnats at gcc dot gnu dot org
- Date: 26 Mar 2003 14:16:51 -0000
- Subject: c++/10223: template trickery causes ICE (segmentation fault)
- Reply-to: hg211 at ural2 dot hszk dot bme dot hu
>Number: 10223
>Category: c++
>Synopsis: template trickery causes ICE (segmentation fault)
>Confidential: no
>Severity: serious
>Priority: low
>Responsible: unassigned
>State: open
>Class: ice-on-legal-code
>Submitter-Id: net
>Arrival-Date: Wed Mar 26 14:26:01 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator: Geza Herman
>Release: All gcc versions
>Organization:
>Environment:
Linux 2.4.18 i686 Debian GNU/Linux
>Description:
The code sample causes ICE an all gcc versions I tried:
gcc version 2.95.4 20011002 (Debian prerelease)
gcc version 3.0.4
gcc version 3.2.3 20030316 (Debian prerelease)
gcc version 3.3 20030314 (prerelease)
The sample tries to get some meta-information: tries to determine if a class has a particular member-function.
('void save()' in this example)
>How-To-Repeat:
compile this sample:
template <typename T>
class hasSaveFunction {
private:
struct Helper {
struct False { char dummy[1979]; };
template <void (T::*)()>
struct dummy;
template <typename T2>
static char test(dummy<&T2::save> *);
template <typename T2>
static False test(...);
};
public:
static const bool value = sizeof(Helper::template test<T>(0))==1
;
};
class Dummy { };
int main() {
return hasSaveFunction<Dummy>::value;
}
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted: