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++/12601] New: bogus error on extern template called from static function


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

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

           Summary: bogus error on extern template called from static
                    function
           Product: gcc
           Version: 3.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: sebor at roguewave dot com
                CC: gcc-bugs at gcc dot gnu dot org

The program below fails to compile with gcc 3.3 at -O3. It compiles successfully
at lower optimization levels. Tested on SunOS 5.7, not sure about other platforms.

Regards
Martin

$ cat t.cpp && gcc -O3 -c t.cpp
/*   1 */ template <class T>
/*   2 */ struct S
/*   3 */ {
/*   4 */     int foo ();
/*   5 */ };
/*   6 */ 
/*   7 */ extern template struct S<char>;
/*   8 */ 
/*   9 */ static int foobar ()
/*  10 */ {
/*  11 */     return S<char>().foo ();
/*  12 */ }
/*  13 */ 
t.cpp: In instantiation of `int S<T>::foo() [with T = char]':
t.cpp:11:   instantiated from here
t.cpp:11: error: explicit instantiation of `int S<T>::foo() [with T = char]' 
   but no definition available


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