Your message dated Sun, 26 Jul 2009 08:59:22 +0200 with message-id <[email protected]> and subject line Re: Bug#538647: g++-4.3: g++ examines second value to "?" always if it is a template has caused the Debian Bug report #538647, regarding g++-4.3: g++ examines second value to "?" always if it is a template to be marked as done.
This means that you claim that the problem has been dealt with. If this is not the case it is now your responsibility to reopen the Bug report if necessary, and/or fix the problem forthwith. (NB: If you are a system administrator and have no idea what this message is talking about, this may indicate a serious mail system misconfiguration somewhere. Please contact [email protected] immediately.) -- 538647: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=538647 Debian Bug Tracking System Contact [email protected] with problems
--- Begin Message ---Package: g++-4.3 Version: 4.3.2-1.1 Severity: important Let an example do the talking template< unsigned int result, unsigned int wanted, unsigned int guess > struct log2_calculator; // Specialisation that ends recursion. template< unsigned int result, unsigned int wanted > struct log2_calculator< result, wanted, 0> { enum { value = 0 }; // Invalid. }; template< unsigned int result, unsigned int wanted, unsigned int guess > struct log2_calculator { typedef log2_calculator< result+1, wanted, guess << 1 > next_value_type; /*HERE*/enum { value = (wanted <= guess) ? result : next_value_type::value }; }; The intention of this code is to work out log2(a) at compile time, lacking some other mechanism. This allows... enum { is3 = log2_calculator< 0, 8, 1 >::value }; enum { is4 = log2_calculator< 0, 16, 1 >::value }; enum { is6 = log2_calculator< 0, 64, 1 >::value }; ....something that's more obviously useful inside templates. enum { isX = log2_calculator< 0, sizeof(N)*8, 1 >::value }; Anyway, the problem becomes obvious when you omit the specialisation from the above - g++ reaches it's template nesting limit because it's instantiating the template that's the second value to "?" even though the conditional is true. I've marked the line above with /*HERE*/. -- System Information: Debian Release: 5.0.2 APT prefers stable APT policy: (500, 'stable') Architecture: amd64 (x86_64) Kernel: Linux 2.6.26-2-amd64 (SMP w/2 CPU cores) Locale: LANG=en_IE.UTF-8, LC_CTYPE=en_IE.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/bash Versions of packages g++-4.3 depends on: ii gcc-4.3 4.3.2-1.1 The GNU C compiler ii gcc-4.3-base 4.3.2-1.1 The GNU Compiler Collection (base ii libc6 2.7-18 GNU C Library: Shared libraries ii libgmp3c2 2:4.2.2+dfsg-3 Multiprecision arithmetic library ii libmpfr1ldbl 2.3.1.dfsg.1-2 multiple precision floating-point ii libstdc++6-4.3-dev 4.3.2-1.1 The GNU Standard C++ Library v3 (d g++-4.3 recommends no packages. Versions of packages g++-4.3 suggests: ii g++-4.3-multilib 4.3.2-1.1 The GNU C++ compiler (multilib fil ii gcc-4.3-doc 4.3.2.nf1-1 documentation for the GNU compiler pn libstdc++6-4.3-dbg <none> (no description available) -- no debconf information
--- End Message ---
--- Begin Message ---* Philip Ashmore: > /*HERE*/enum { value = (wanted <= guess) ? result : next_value_type::value }; Not a bug. You need to implement your own conditional operator at the template level to make this work. The version with ?: is not valid C++.
--- End Message ---

