[Bug c++/12635] New: wrong interpretation of typename with constructor delimiters

numerical dot simulation at web dot de gcc-bugzilla@gcc.gnu.org
Thu Oct 16 09:24:00 GMT 2003


PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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

           Summary: wrong interpretation of typename with constructor
                    delimiters
           Product: gcc
           Version: 3.4
            Status: UNCONFIRMED
          Severity: critical
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: numerical dot simulation at web dot de
                CC: gcc-bugs at gcc dot gnu dot org,numerical dot simulation
                    at web dot de
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu

g++ (GCC) 3.4 20031015 rejects this IMHO perfectly valid code: 
 
template <typename T> struct Expr {}; 
 
struct Some; 
 
// workaround some early diagnostics (incomplete type problem) below 
template<typename, typename U> struct LazyBind { typedef U type; }; 
 
class Error 
{ 
  double Value_; 
 
public: 
  template <class T> Error(Expr<T> const & E) 
    : 
    Value_(LazyBind<T, Some>::type()(E))  
  {}  
}; 
 
struct Some 
{ 
  template <typename T> 
  double operator()(T const & t) { return 42.0; } 
}; 
 
int main() 
{ 
  Expr<int> E; 
  Error err(E); 
}



More information about the Gcc-bugs mailing list