public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/14032] New: non type boolean template argument partial specialization to argument in parent never matches
@ 2004-02-05 20:54 tschwinger at neoscientists dot org
  2004-02-05 20:59 ` [Bug c++/14032] " tschwinger at neoscientists dot org
                   ` (8 more replies)
  0 siblings, 9 replies; 12+ messages in thread
From: tschwinger at neoscientists dot org @ 2004-02-05 20:54 UTC (permalink / raw)
  To: gcc-bugs

Compiled with gcc 3.3.1 (cygwin), 3.2.3 (gentoo-linux), mingw32 3.2 the test 
code included in this report generates an endless recursion.
It compiles without errors or warnings so the underlying problem can be quite 
hard to track for the user.

$ cat <<EOF >test.cpp
#include <iostream>

template <bool compare>
struct outer
{
  template <bool compare_with,bool second>
  struct inner           // unspecialized compare != compare_with
  {
    static inline void test()
    {
      std::cout << "invert" << std::endl;
      // call version with inverted template value
      inner<! compare_with, ! second>::test();
    }
  };
  template <bool second> // specialization compare == compare_with
  struct inner<compare,second>
  {
    static inline void test()
    {
      std::cout << "second: " << second << std::endl;
    }
  };
};
int main(int argc,char* argv[],char** envp)
{
  // expected output:
  //  invert
  //  second: true
  outer<false>::inner<true,false>::test();

  // expected output:
  //  second: false
  outer<true>::inner<true,false>::test();

  return 0;
}

EOF
$ make test && ./test

-- 
           Summary: non type boolean template argument partial
                    specialization to argument in parent never matches
           Product: gcc
           Version: 3.3.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: tschwinger at neoscientists dot org
                CC: gcc-bugs at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14032


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug c++/14032] non type boolean template argument partial specialization to argument in parent never matches
  2004-02-05 20:54 [Bug c++/14032] New: non type boolean template argument partial specialization to argument in parent never matches tschwinger at neoscientists dot org
@ 2004-02-05 20:59 ` tschwinger at neoscientists dot org
  2004-02-05 21:51 ` bangerth at dealii dot org
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 12+ messages in thread
From: tschwinger at neoscientists dot org @ 2004-02-05 20:59 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |wrong-code
      Known to fail|                            |3.3.1 3.2.3


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14032


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug c++/14032] non type boolean template argument partial specialization to argument in parent never matches
  2004-02-05 20:54 [Bug c++/14032] New: non type boolean template argument partial specialization to argument in parent never matches tschwinger at neoscientists dot org
  2004-02-05 20:59 ` [Bug c++/14032] " tschwinger at neoscientists dot org
@ 2004-02-05 21:51 ` bangerth at dealii dot org
  2004-02-05 21:54 ` bangerth at dealii dot org
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 12+ messages in thread
From: bangerth at dealii dot org @ 2004-02-05 21:51 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From bangerth at dealii dot org  2004-02-05 21:51 -------
Confirmed. Reduced, this looks so: 
--------------------------- 
template <bool B1> struct outer { 
    template <bool B2, bool B3> 
    struct inner { 
        static int f() { return inner<!B2,!B3>::N; }; 
    }; 
 
    template <bool B3> 
    struct inner<B1,B3> { 
        static const int N = 1; 
    }; 
}; 
 
int i = outer<false>::inner<true,false>::f(); 
--------------------------- 
This should compile, since in f() we should look into the specialization, 
but we don't. And never did. 
 
W. 

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
      Known to fail|3.3.1 3.2.3                 |3.3.1 3.2.3 2.95.3 3.4.0
                   |                            |3.5.0
   Last reconfirmed|0000-00-00 00:00:00         |2004-02-05 21:51:20
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14032


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug c++/14032] non type boolean template argument partial specialization to argument in parent never matches
  2004-02-05 20:54 [Bug c++/14032] New: non type boolean template argument partial specialization to argument in parent never matches tschwinger at neoscientists dot org
  2004-02-05 20:59 ` [Bug c++/14032] " tschwinger at neoscientists dot org
  2004-02-05 21:51 ` bangerth at dealii dot org
@ 2004-02-05 21:54 ` bangerth at dealii dot org
  2004-02-06 18:47 ` giovannibajo at libero dot it
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 12+ messages in thread
From: bangerth at dealii dot org @ 2004-02-05 21:54 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From bangerth at dealii dot org  2004-02-05 21:54 -------
And just as a sidenote: this bug may be related to the fact 
that we reject this explicit (full) specialization in this code: 
------------------------- 
template <bool B1> struct outer { 
    template <bool B2> 
    struct inner { 
        static int f() { return inner<!B2>::N; }; 
    }; 
 
    template <> 
    struct inner<B1> { 
        static const int N = 1; 
    }; 
}; 
 
int i = outer<false>::inner<true>::f(); 
---------------------------- 
 
g/x> /home/bangerth/bin/gcc-3.4-pre/bin/c++ x.cc -c 
x.cc:7: error: invalid explicit specialization before '>' token 
x.cc:7: error: explicit specialization in non-namespace scope `struct 
outer<B1>' 
x.cc:7: error: enclosing class templates are not explicitly specialized 
g/x>  
g/x> icc -c x.cc 
g/x>  

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14032


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug c++/14032] non type boolean template argument partial specialization to argument in parent never matches
  2004-02-05 20:54 [Bug c++/14032] New: non type boolean template argument partial specialization to argument in parent never matches tschwinger at neoscientists dot org
                   ` (2 preceding siblings ...)
  2004-02-05 21:54 ` bangerth at dealii dot org
@ 2004-02-06 18:47 ` giovannibajo at libero dot it
  2004-02-06 19:05 ` bangerth at dealii dot org
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 12+ messages in thread
From: giovannibajo at libero dot it @ 2004-02-06 18:47 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From giovannibajo at libero dot it  2004-02-06 18:47 -------
Testcase in comment #2 by Wolfgang is ill-formed because of [temp.expl.spec]/2: 
explicit specializations must always be defined at namespace scope. Instead, 
partial specialization can be defined at class scope.

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14032


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug c++/14032] non type boolean template argument partial specialization to argument in parent never matches
  2004-02-05 20:54 [Bug c++/14032] New: non type boolean template argument partial specialization to argument in parent never matches tschwinger at neoscientists dot org
                   ` (3 preceding siblings ...)
  2004-02-06 18:47 ` giovannibajo at libero dot it
@ 2004-02-06 19:05 ` bangerth at dealii dot org
  2004-07-30 17:30 ` lerdsuwa at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 12+ messages in thread
From: bangerth at dealii dot org @ 2004-02-06 19:05 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From bangerth at dealii dot org  2004-02-06 19:05 -------
I was basically looking at the first line of errors only, so 
totally missed the rest. Sorry. The example in #1 should be 
valid, though. 
 
W. 

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14032


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug c++/14032] non type boolean template argument partial specialization to argument in parent never matches
  2004-02-05 20:54 [Bug c++/14032] New: non type boolean template argument partial specialization to argument in parent never matches tschwinger at neoscientists dot org
                   ` (4 preceding siblings ...)
  2004-02-06 19:05 ` bangerth at dealii dot org
@ 2004-07-30 17:30 ` lerdsuwa at gcc dot gnu dot org
  2004-08-14 14:20 ` lerdsuwa at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 12+ messages in thread
From: lerdsuwa at gcc dot gnu dot org @ 2004-07-30 17:30 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From lerdsuwa at gcc dot gnu dot org  2004-07-30 17:30 -------
Related to PR4882, PR13088.

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14032


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug c++/14032] non type boolean template argument partial specialization to argument in parent never matches
  2004-02-05 20:54 [Bug c++/14032] New: non type boolean template argument partial specialization to argument in parent never matches tschwinger at neoscientists dot org
                   ` (5 preceding siblings ...)
  2004-07-30 17:30 ` lerdsuwa at gcc dot gnu dot org
@ 2004-08-14 14:20 ` lerdsuwa at gcc dot gnu dot org
  2004-11-28 10:49 ` lerdsuwa at gcc dot gnu dot org
  2005-09-23 22:49 ` pinskia at gcc dot gnu dot org
  8 siblings, 0 replies; 12+ messages in thread
From: lerdsuwa at gcc dot gnu dot org @ 2004-08-14 14:20 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2004-04-27 01:21:19         |2004-08-14 14:20:42
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14032


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug c++/14032] non type boolean template argument partial specialization to argument in parent never matches
  2004-02-05 20:54 [Bug c++/14032] New: non type boolean template argument partial specialization to argument in parent never matches tschwinger at neoscientists dot org
                   ` (6 preceding siblings ...)
  2004-08-14 14:20 ` lerdsuwa at gcc dot gnu dot org
@ 2004-11-28 10:49 ` lerdsuwa at gcc dot gnu dot org
  2005-09-23 22:49 ` pinskia at gcc dot gnu dot org
  8 siblings, 0 replies; 12+ messages in thread
From: lerdsuwa at gcc dot gnu dot org @ 2004-11-28 10:49 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From lerdsuwa at gcc dot gnu dot org  2004-11-28 10:47 -------
Work postponed to GCC 4.1.  This bug is tricky to fix.

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14032


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug c++/14032] non type boolean template argument partial specialization to argument in parent never matches
  2004-02-05 20:54 [Bug c++/14032] New: non type boolean template argument partial specialization to argument in parent never matches tschwinger at neoscientists dot org
                   ` (7 preceding siblings ...)
  2004-11-28 10:49 ` lerdsuwa at gcc dot gnu dot org
@ 2005-09-23 22:49 ` pinskia at gcc dot gnu dot org
  8 siblings, 0 replies; 12+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-09-23 22:49 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |rejects-valid
   Last reconfirmed|2005-05-27 01:00:14         |2005-09-23 22:49:50
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14032


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug c++/14032] non type boolean template argument partial specialization to argument in parent never matches
       [not found] <bug-14032-7865@http.gcc.gnu.org/bugzilla/>
  2005-10-22 13:57 ` lerdsuwa at gcc dot gnu dot org
@ 2006-11-09  5:25 ` bangerth at dealii dot org
  1 sibling, 0 replies; 12+ messages in thread
From: bangerth at dealii dot org @ 2006-11-09  5:25 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from bangerth at dealii dot org  2006-11-09 05:25 -------
*** Bug 29767 has been marked as a duplicate of this bug. ***


-- 

bangerth at dealii dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pluto at agmk dot net


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14032


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Bug c++/14032] non type boolean template argument partial specialization to argument in parent never matches
       [not found] <bug-14032-7865@http.gcc.gnu.org/bugzilla/>
@ 2005-10-22 13:57 ` lerdsuwa at gcc dot gnu dot org
  2006-11-09  5:25 ` bangerth at dealii dot org
  1 sibling, 0 replies; 12+ messages in thread
From: lerdsuwa at gcc dot gnu dot org @ 2005-10-22 13:57 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from lerdsuwa at gcc dot gnu dot org  2005-10-22 13:57 -------
Won't work on it for a long while.


-- 

lerdsuwa at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|lerdsuwa at gcc dot gnu dot |unassigned at gcc dot gnu
                   |org                         |dot org
             Status|ASSIGNED                    |NEW


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14032


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2006-11-09  5:25 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-02-05 20:54 [Bug c++/14032] New: non type boolean template argument partial specialization to argument in parent never matches tschwinger at neoscientists dot org
2004-02-05 20:59 ` [Bug c++/14032] " tschwinger at neoscientists dot org
2004-02-05 21:51 ` bangerth at dealii dot org
2004-02-05 21:54 ` bangerth at dealii dot org
2004-02-06 18:47 ` giovannibajo at libero dot it
2004-02-06 19:05 ` bangerth at dealii dot org
2004-07-30 17:30 ` lerdsuwa at gcc dot gnu dot org
2004-08-14 14:20 ` lerdsuwa at gcc dot gnu dot org
2004-11-28 10:49 ` lerdsuwa at gcc dot gnu dot org
2005-09-23 22:49 ` pinskia at gcc dot gnu dot org
     [not found] <bug-14032-7865@http.gcc.gnu.org/bugzilla/>
2005-10-22 13:57 ` lerdsuwa at gcc dot gnu dot org
2006-11-09  5:25 ` bangerth at dealii dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).