From dev-return-8184-apmail-stdcxx-dev-archive=stdcxx.apache.org@stdcxx.apache.org Fri Jul 11 03:09:11 2008 Return-Path: Delivered-To: apmail-stdcxx-dev-archive@www.apache.org Received: (qmail 76057 invoked from network); 11 Jul 2008 03:09:11 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 11 Jul 2008 03:09:11 -0000 Received: (qmail 15497 invoked by uid 500); 11 Jul 2008 03:09:11 -0000 Delivered-To: apmail-stdcxx-dev-archive@stdcxx.apache.org Received: (qmail 15475 invoked by uid 500); 11 Jul 2008 03:09:11 -0000 Mailing-List: contact dev-help@stdcxx.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@stdcxx.apache.org Delivered-To: mailing list dev@stdcxx.apache.org Received: (qmail 15464 invoked by uid 99); 11 Jul 2008 03:09:11 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 10 Jul 2008 20:09:11 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of msebor@gmail.com designates 209.85.198.225 as permitted sender) Received: from [209.85.198.225] (HELO rv-out-0506.google.com) (209.85.198.225) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 11 Jul 2008 03:08:16 +0000 Received: by rv-out-0506.google.com with SMTP id g37so3512066rvb.23 for ; Thu, 10 Jul 2008 20:08:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :organization:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding:sender; bh=c7g/mjWWutTZULNaS0iTtbBTjdoC0Daw80D+0nznNsQ=; b=I+5Is/rZRLfocpbWyd4yCLdukAM2V34JslooXCIEctme4WlxUd0NDZ8xp+sqU0F2uK hqdX69kdiEB7VcP0A/8ELjz+j/LJAkpDwt4HXWGocBACtLwmSfonGRXiE46SYLoxY5e8 K+mEUyODTW5UHpA3lp0GZ5S3sWPb3D5+YaJ+g= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:organization:user-agent:mime-version:to :subject:references:in-reply-to:content-type :content-transfer-encoding:sender; b=WcTG2yCQK2Pzbe38wU9TagYHygntcbDgyoqiKlEQaNZ1QaqJNPKcHe0iAsb/vytWqr vDHSc9e3hvFQA9mixcnyXE0lD17Hhr8cD1Zih2Um3srfsteQ5S1BwEL3Viq2gSOK+iGI SBXdqCpI04symu2ZSf+I/CRAil5IvTb3fpnrA= Received: by 10.114.177.1 with SMTP id z1mr12995321wae.37.1215745718898; Thu, 10 Jul 2008 20:08:38 -0700 (PDT) Received: from localhost.localdomain ( [71.229.200.170]) by mx.google.com with ESMTPS id b39sm171977rvf.8.2008.07.10.20.08.38 (version=TLSv1/SSLv3 cipher=RC4-MD5); Thu, 10 Jul 2008 20:08:38 -0700 (PDT) Message-ID: <4876CEB5.9080502@roguewave.com> Date: Thu, 10 Jul 2008 21:08:37 -0600 From: Martin Sebor Organization: Rogue Wave Software, Inc. User-Agent: Thunderbird 2.0.0.14 (X11/20080501) MIME-Version: 1.0 To: dev@stdcxx.apache.org Subject: Re: Potential eccp-3.9 bug References: <487680E1.5070006@roguewave.com> <48769C47.1050509@roguewave.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Sender: Martin Sebor X-Virus-Checked: Checked by ClamAV on apache.org Travis Vitek wrote: > > > Martin Sebor wrote: >> Travis Vitek wrote: >>> >>> >>> Not always. If the template is instantiated the error would >>> not be seen. >> The reason I ask is because I couldn't get even a simple SFINAE >> test program to compile. I think the program is well-formed even >> though gcc 4.3.0 chokes on too (albeit for a different reason -- >> see http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36797) >> > > Hah, I was just filing a nearly identical bug with gcc when I got this > message. > > I happened to be playing around with this a little bit earlier today. > You might find this interesting. If I use the pseudo-function > __is_empty() directly, the error message says there is no matching > function, but if I wrap it in a template, I get multiple matches (after > the incomplete class type message I complained about earlier). > > This all seems to work when using the trait with a non-template type. If > you want to use a template, it has to be instantiated first. I think I'm > going to put the Edison compiler port on hold for now. Yeah, it doesn't seem quite stable enough. Let's see what they come back with, but unless there's something we're missing it might be best to wait for 3.10. I assume HP aCC 6 isn't any better? > > $ cat t.cpp > > template > struct enable_if { > typedef T type; > }; > > template > struct enable_if { > }; > > #ifdef _TEMPLATE > > template > struct is_empty { > enum { val = __is_empty(T) }; > }; > > template > int enabled_if_empty (typename enable_if< is_empty::val>::type* = 0) > { > return 1; > } > > template > int enabled_if_empty (typename enable_if::val>::type* = 0) > { > return 0; > } > > #else // !_TEMPLATE > > template > int enabled_if_empty (typename enable_if< __is_empty(T)>::type* = 0) { > return 1; > } > > template > int enabled_if_empty (typename enable_if::type* = 0) { > return 0; > } > > #endif // !_TEMPLATE > > template struct S { }; > > #include > > //template struct S<1>; > > int main () { > > assert (0 == enabled_if_empty< S<1> >()); > assert (1 == enabled_if_empty< long >()); > > return 0; > } > > $ eccp -A t.cpp > "t.cpp", line 50: error: no instance of overloaded function > "enabled_if_empty" > matches the argument list > assert (0 == enabled_if_empty< S<1> >()); > ^ > > 1 error detected in the compilation of "t.cpp". > $ eccp -A -D_TEMPLATE t.cpp > "t.cpp", line 15: error: an incomplete class type is not allowed > enum { val = __is_empty(T) }; > ^ > detected during instantiation of class "is_empty [with > T=S<1>]" > at line 50 > > "t.cpp", line 50: error: more than one instance of overloaded function > "enabled_if_empty" matches the argument list: > function template "int > enabled_if_empty(enable_if::val, > void>::type *)" > function template "int > enabled_if_empty(enable_if<, > void>::type *)" > assert (0 == enabled_if_empty< S<1> >()); > ^ > > 2 errors detected in the compilation of "t.cpp". >