[Bug c++/26267] New: template function implicity instatiated

2006-02-13 Thread eduffy at gmail dot com
While compiling:

template
struct Type2Type {
   typedef T Type;
};

template
inline void foo(Type2Type 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



[Bug c++/26268] New: template function implicity instatiated

2006-02-13 Thread eduffy at gmail dot com
While compiling:

template
struct Type2Type {
   typedef T Type;
};

template
inline void foo(Type2Type 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=26268