c++/383: C++v2,96:member template conversion not implicit

Wolfgang Bangerth bangerth@ticam.utexas.edu
Tue Oct 22 15:16:00 GMT 2002


The following reply was made to PR c++/383; it has been noted by GNATS.

From: Wolfgang Bangerth <bangerth@ticam.utexas.edu>
To: gcc-bugs@gcc.gnu.org, <gcc-gnats@gcc.gnu.org>
Cc: jcampbell3@prodigy.net
Subject: Re: c++/383: C++v2,96:member template conversion not implicit
Date: Tue, 22 Oct 2002 17:14:06 -0500 (CDT)

 This bug still applies with present CVS and 3.2. A slightly simpler to 
 read form of the report is this:
 -----------------------------------------
 template <bool P> struct X {
     template <bool PP> operator X<PP>& (void);
 };
 
 int main(void) {
   X<true> x;
   static_cast<X<false> >(x);
   X<false> y = x;
 };
 -----------------------------------------
 The messages are
 y.cc: In function `int main()':
 y.cc:7: error: no matching function for call to `X<false>::X(X<true>&)'
 y.cc:1: error: candidates are: X<false>::X()
 y.cc:1: error:                 X<false>::X(const X<false>&)
 y.cc:8: error: conversion from `X<true>' to non-scalar type `X<false>'
    requested
 
 Regards
   Wolfgang
 
 -------------------------------------------------------------------------
 Wolfgang Bangerth              email:           bangerth@ticam.utexas.edu
                                www: http://www.ticam.utexas.edu/~bangerth
 
 



More information about the Gcc-prs mailing list