I've commented the following code with, or whithout (uh!), the errors that g++
reports.

template< typename _Type >
struct S {

 operator S();

}; // struct S< _Type >

template< typename _Type >
struct T {

 S< _Type > t_;
 S< int > i_;

 void
 foo() {

   t_.S();                        // 1.1 uh!
   t_.S< _Type >();               // 1.2
   // i_.S();                        // 1.3 invalid use of `struct S<int>'
   // i_.S< int >();                 // 1.4 internal compiler error: in
lookup_member, at cp/search.c:1287

   // t_.~S();                       // 2.1 expected class-name before '('
token
   t_.~S< _Type >();              // 2.2
   i_.~S();                       // 2.3 uh!
   i_.~S< int >();                // 2.4

   // t_.operator S();               // 3.1 `S' is not a type
   t_.operator S< _Type >();      // 3.2
   i_.operator S();               // 3.2 uh!
   i_.operator S< int >();        // 3.4
 }

}; // struct T< _Type >


-- 
           Summary:  Explicit invocation of constructors, destructors and
                    conversion operators in template code
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: fasbjx at free dot fr
 GCC build triplet: x86_64-pc-linux-gnu
  GCC host triplet: x86_64-pc-linux-gnu
GCC target triplet: x86_64-pc-linux-gnu


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

Reply via email to