ostream& operator<<(ostream& os, Graph<VertexType,EdgeType>& G)
{
// display of vertices with successors
- for(int i = 0; i < G.size(); ++i)
+ for(int i = 0; i < G.size(); ++i) // ERROR - no size function
{
- os << G[i].first << " <";
+ os << G[i].first << " <"; // ERROR - no index operator
// The compiler does not like this line!!!!!!
typename Graph<VertexType, EdgeType>::Successor::iterator
- startN = G[i].second.begin(),
- endN = G[i].second.end();
+ startN = G[i].second.begin(), // ERROR - no index operator
+ endN = G[i].second.end(); // ERROR - no index operator
while(startN != endN)
{
os << G[(*startN).first].first << ' ' // vertex
- << (*startN).second << ' '; // edge value
+ << (*startN).second << ' '; // ERROR - no index operator
++startN;
}
os << ">\n";
int main()
{
// no edge weighting, therefore type Empty:
- Graph<string, Empty> V(true); // directed
+ Graph<string, Empty> V(true); // ERROR - no bool constructor
// ReadGraph(V, "gra1.dat");
// display of vertices with successors
+// Test for obsolete specialization syntax. Turn off -pedantic.
+// Special g++ Options:
+
#include <iostream.h>
#include <typeinfo>
}
// Specialization declaration
void
-A<double>::test(); // ERROR - not a specialization
+A<double>::test();
// Specialization definition
void
-A<double>::test(){ // ERROR - not a specialization
+A<double>::test(){
cerr << "specialization for " << typeid(*this).name() << endl;
}
+++ /dev/null
-//Build don't link:
-//Neither stack nor vector provide priority_queue, use <queue> instead
-#include <stack>
-#include <vector>
-
-
-int main()
-{
- priority_queue< int, vector<int>, greater<int> > pq; // ERROR - unknown template
- return 0;
-}
template <class T> class Expr
{
public :
-Expr(){};
-Expr(const T&){};
+ Expr(){};
+ Expr(const T&){};
};
template <class T >
// spurious 'const' in error.
+// For egcs-2.91.34, the warning message refers to
+// class ostream & operator <<(class ostream &, const class Vector<T> &)
+// Also, the template instantiation does not provide the missing
+// friend function, the non-template function does
#include <stdio.h>
#include <iostream.h>
template <class T>
class Vector
{
- friend ostream& operator<< (ostream& out, const Vector<T> & vec);
+ friend ostream& operator<< (ostream& out, const Vector<T> & vec); // WARNING -
};
template <class T>
ostream& operator<< (ostream& out, const Vector<T> & vec)
-{}
+{
+ abort(); // this should not be called
+}
template class Vector<char>;
template ostream& operator<< (ostream& out, const Vector<char> &);
+ostream& operator<< (ostream& out, const Vector<char>&)
+{
+ return out;
+}
+
main()
{
Vector<char> vc;
main()
{
- A *list = new A[10](4); //ERROR -
+ A *list = new A[10](4);
}
}
enum T {
- V1,
-}; //ERROR - comma at end of enumerator list
+ V1
+};
struct X {
T t : 31;
void
f(X& v) {
- if( v.t != V1 ) {
+ if( v.t != V1 ) { // gets bogus error - address of bitfield
}
}
UserClass::f(const String& filename) throw(BadFileName)
{
try {
- File f(filename);
+ File f(filename); // WARNING - unused
}
catch (const AccessViolation& e) {
cout << " FULLY recover from access-violation\n";