This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/21510] Possible bug
- From: "sven at clio dot in-berlin dot de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 16 May 2005 10:22:11 -0000
- Subject: [Bug c++/21510] Possible bug
- References: <20050511102800.21510.sven@clio.in-berlin.de>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From sven at clio dot in-berlin dot de 2005-05-16 10:22 -------
(In reply to comment #7)
> > Is there a way to distinguish between unions (which are not usable as base
> > classes) and classes? If not, the standard is incomplete.
>
> You should know that 10 years ago people didn't even imagine the kind of
> template usages that you are assuming as obvious. Indeed, everyone wants
> to tell unions from classes now and you bet, it will be possible sometime
> in the future, likely not using SFINAE at all.
I know and accept this. SFINAE is a possible dangerous feature, anyway. It may
be better if the ISO standard declares something like the following
(incomplete, feel free to propose it to the standard comitee):
The pragma statements
_Pragme(set, "sfinae", on) // enables SFINAE
_Pragma(set, "sfinae", off) // disables SFINAE
_Pragma(reset, "sfinae") // sets SFINAE to the previous state
control the substitution-failure-is-not-an-error-feature. When setting to "on"
any substitution of a template argument of a class or function declared or
defined in the context may fail without an error, if
- the statement is syntactical correct
- there is a less specific template which could be instantiated without an
error.
When leaving the context, _Pragma(reset, "sfinae") is called automatical. The
user is complete responsible for using SFINAE, no further compiler support is
standardized.
This would localize the feature and alert the user that this is a potential
dangerous construct. And it is much more general, possible easier to
implement.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21510