This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/17413] [3.4/4.0 regression] local classes as template argument


------- Additional Comments From bangerth at dealii dot org  2004-09-12 22:54 -------
This is related to the substitution-failure-is-not-an-error thingy: we 
realize that a local class cannot be matched against a template argument, 
so we drop the template function std::for_each from the overload list -- 
and end up with an empty list, thus the error message. 
 
We probably need to special-case the overload resolution process to handle 
this case: when we end up with an empty overload list but there is a 
function that would match were it not for a local class, we should report 
so. Whether this kind of special-casing is desirable is another matter. 
 
Reduced testcase is this: 
------------------- 
template <typename T> void foo() {}; 
 
int main () { 
  struct S {}; 
  foo<S> (); 
} 
----------------- 
g/x> /home/bangerth/bin/gcc-3.3.4-pre/bin/c++ -c x.cc 
x.cc: In function `int main()': 
x.cc:5: error: template-argument `main()::S' uses local type `main()::S' 
x.cc:5: error: no matching function for call to `foo()' 
g/x>  
g/x> /home/bangerth/bin/gcc-3.4-pre/bin/c++ -c x.cc 
x.cc: In function `int main()': 
x.cc:5: error: no matching function for call to `foo()' 
g/x>  
g/x> /home/bangerth/bin/gcc-3.5-pre/bin/c++ -c x.cc 
x.cc: In function `int main()': 
x.cc:5: error: no matching function for call to `foo()' 
 
W. 

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
           Keywords|                            |diagnostic
      Known to fail|                            |3.4.2 4.0.0
      Known to work|                            |3.3.4
   Last reconfirmed|0000-00-00 00:00:00         |2004-09-12 22:54:43
               date|                            |
            Summary|diagnostic regression for   |[3.4/4.0 regression] local
                   |local classes as template   |classes as template argument
                   |argument                    |
   Target Milestone|---                         |3.4.3


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]