Topic: Implicit instantiation and the semantic analysis of definitions of templates.
Author: "Michael Kochetkov" <Michael.Kochetkov@trustworks.commmm>
Date: Thu, 20 Sep 2001 18:50:17 GMT Raw View
[...]
> > Having studied 14.7.1 I have come to a conclusion that the example above
[...]
> > The question is: does the Standard admits the semantic analysis of
> > _definitions_ of parameterized functions or member functions which will
> > never be instantiated? (I believe that all the marked lines above are
> > syntactically correct.)
>
> 14.6/7 says:
> If no valid specialization can be generated for a template definition, and
that
> template is not instantiated, the template definition is ill-formed, no
> diagnostic required. [Note: if a template is instantiated, errors will be
> diag nosed according to the other rules in this Standard. Exactly when
these
> errors are diagnosed is a quality of implementation issue. ]
>
> It then gives an example.
Thank you. I have looked at the wrong place.
With regards,
Michael Kochetkov.
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html ]
Author: "Michael Kochetkov" <Michael.Kochetkov@trustworks.commmm>
Date: Wed, 19 Sep 2001 18:19:36 GMT Raw View
Let us consider the following code:
[Example:
template <class T>
class A {
public:
void f();
};
template <class T>
void A<T>::f() {
0 = 1; // AAAA
sdfg(); // BBBB
T::a = 0; // CCCC
}
template <class T>
void g() {
0 = 1; // DDDD
sdfg(); // EEEE
T::a = 0; // FFFF
}
int
main()
{
A<int> a;
}
-- end example]
Having studied 14.7.1 I have come to a conclusion that the example above
shall be well-formed. But Comeau C++ since 4.2.44 begins to treat AAAA,
BBBB, DDDD and EEEE as errors (all the other compilers I have access to
treat the example above as well-formed).
The question is: does the Standard admits the semantic analysis of
_definitions_ of parameterized functions or member functions which will
never be instantiated? (I believe that all the marked lines above are
syntactically correct.)
Thank you in advance,
with regards,
Michael Kochetkov.
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html ]