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++/26267] New: template function implicity instatiated


While compiling:

template<typename T>
struct Type2Type {
   typedef T Type;
};

template<class T>
inline void foo(Type2Type<T> const&) {
   int x = NOT_HERE;
}

int main(int, char *) {
 //  std::cout << "Hello world!" << std::endl;
}

g++ gives an error about NOT_HERE being declared.  Rightly so, but the function
`foo' is never called or explicity instantiated, so `foo' should never be
compiled.

>From "14.7.1 Implicit instantiation" of the ISO C++ standard:
 9. An implementation shall not implicitly instantiate a function template,
    a member template, a non-virtual member function, a member class or a
    static data member of a class template that does not require instantia-
    tion.


-- 
           Summary: template function implicity instatiated
           Product: gcc
           Version: 4.0.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: eduffy at gmail dot com
  GCC host triplet: i686-pc-linux-gnu


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


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