From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25056 invoked by alias); 16 Nov 2002 02:26:01 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 25042 invoked by uid 71); 16 Nov 2002 02:26:00 -0000 Date: Thu, 21 Nov 2002 21:06:00 -0000 Message-ID: <20021116022600.25041.qmail@sources.redhat.com> To: nobody@gcc.gnu.org Cc: gcc-prs@gcc.gnu.org, From: Wolfgang Bangerth Subject: Re: c++/3671: g++ incorrectly tries to instantiate multiple member template specializations Reply-To: Wolfgang Bangerth X-SW-Source: 2002-11/txt/msg00814.txt.bz2 List-Id: The following reply was made to PR c++/3671; it has been noted by GNATS. From: Wolfgang Bangerth To: gcc-gnats@gcc.gnu.org, Cc: Subject: Re: c++/3671: g++ incorrectly tries to instantiate multiple member template specializations Date: Fri, 15 Nov 2002 20:25:42 -0600 (CST) Good question what happens here: ---------------------------------- enum T1 {a}; enum T2 {b}; struct Y { template void foo(); template void foo(); }; template void Y::foo (); // int main() { // Y c; // c.foo(); // } --------------------------------- I get tmp/g> /home/bangerth/bin/gcc-3.3x-pre/bin/c++ x.cc x.cc:9: error: cannot convert `T1' to `T2' in initialization x.cc:9: error: non-constant `' cannot be used as template argument x.cc: In instantiation of `void Y::foo() [with T1 i = a]': x.cc:9: instantiated from here x.cc:9: error: explicit instantiation of `void Y::foo() [with T1 i = a]' but no definition available If I use the commented main function instead of the explicit instantiation, I get tmp/g> /home/bangerth/bin/gcc-3.3x-pre/bin/c++ x.cc x.cc: In function `int main()': x.cc:13: error: cannot convert `T1' to `T2' in initialization x.cc:13: error: non-constant `' cannot be used as template argument which I find even less helpful. Regards Wolfgang ------------------------------------------------------------------------- Wolfgang Bangerth email: bangerth@ticam.utexas.edu www: http://www.ticam.utexas.edu/~bangerth