Commit dc724178 by Jason Merrill

update

From-SVN: r20220
parent 1813dd7b
...@@ -39,19 +39,19 @@ template<class VertexType, class EdgeType> ...@@ -39,19 +39,19 @@ template<class VertexType, class EdgeType>
ostream& operator<<(ostream& os, Graph<VertexType,EdgeType>& G) ostream& operator<<(ostream& os, Graph<VertexType,EdgeType>& G)
{ {
// display of vertices with successors // 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!!!!!! // The compiler does not like this line!!!!!!
typename Graph<VertexType, EdgeType>::Successor::iterator typename Graph<VertexType, EdgeType>::Successor::iterator
startN = G[i].second.begin(), startN = G[i].second.begin(), // ERROR - no index operator
endN = G[i].second.end(); endN = G[i].second.end(); // ERROR - no index operator
while(startN != endN) while(startN != endN)
{ {
os << G[(*startN).first].first << ' ' // vertex os << G[(*startN).first].first << ' ' // vertex
<< (*startN).second << ' '; // edge value << (*startN).second << ' '; // ERROR - no index operator
++startN; ++startN;
} }
os << ">\n"; os << ">\n";
...@@ -62,7 +62,7 @@ ostream& operator<<(ostream& os, Graph<VertexType,EdgeType>& G) ...@@ -62,7 +62,7 @@ ostream& operator<<(ostream& os, Graph<VertexType,EdgeType>& G)
int main() int main()
{ {
// no edge weighting, therefore type Empty: // 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"); // ReadGraph(V, "gra1.dat");
// display of vertices with successors // display of vertices with successors
......
// Test for obsolete specialization syntax. Turn off -pedantic.
// Special g++ Options:
#include <iostream.h> #include <iostream.h>
#include <typeinfo> #include <typeinfo>
...@@ -14,11 +17,11 @@ A<T>::test(){ ...@@ -14,11 +17,11 @@ A<T>::test(){
} }
// Specialization declaration // Specialization declaration
void void
A<double>::test(); // ERROR - not a specialization A<double>::test();
// Specialization definition // Specialization definition
void void
A<double>::test(){ // ERROR - not a specialization A<double>::test(){
cerr << "specialization for " << typeid(*this).name() << endl; cerr << "specialization for " << typeid(*this).name() << endl;
} }
......
//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;
}
...@@ -4,8 +4,8 @@ ...@@ -4,8 +4,8 @@
template <class T> class Expr template <class T> class Expr
{ {
public : public :
Expr(){}; Expr(){};
Expr(const T&){}; Expr(const T&){};
}; };
template <class T > template <class T >
......
// spurious 'const' in error. // 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 <stdio.h>
#include <iostream.h> #include <iostream.h>
...@@ -6,16 +10,23 @@ ...@@ -6,16 +10,23 @@
template <class T> template <class T>
class Vector class Vector
{ {
friend ostream& operator<< (ostream& out, const Vector<T> & vec); friend ostream& operator<< (ostream& out, const Vector<T> & vec); // WARNING -
}; };
template <class T> template <class T>
ostream& operator<< (ostream& out, const Vector<T> & vec) ostream& operator<< (ostream& out, const Vector<T> & vec)
{} {
abort(); // this should not be called
}
template class Vector<char>; template class Vector<char>;
template ostream& operator<< (ostream& out, const Vector<char> &); template ostream& operator<< (ostream& out, const Vector<char> &);
ostream& operator<< (ostream& out, const Vector<char>&)
{
return out;
}
main() main()
{ {
Vector<char> vc; Vector<char> vc;
......
...@@ -10,5 +10,5 @@ private: ...@@ -10,5 +10,5 @@ private:
main() main()
{ {
A *list = new A[10](4); //ERROR - A *list = new A[10](4);
} }
...@@ -6,8 +6,8 @@ inline bool operator!=(const T& x, const T& y) { ...@@ -6,8 +6,8 @@ inline bool operator!=(const T& x, const T& y) {
} }
enum T { enum T {
V1, V1
}; //ERROR - comma at end of enumerator list };
struct X { struct X {
T t : 31; T t : 31;
...@@ -15,6 +15,6 @@ struct X { ...@@ -15,6 +15,6 @@ struct X {
void void
f(X& v) { f(X& v) {
if( v.t != V1 ) { if( v.t != V1 ) { // gets bogus error - address of bitfield
} }
} }
...@@ -95,7 +95,7 @@ void ...@@ -95,7 +95,7 @@ void
UserClass::f(const String& filename) throw(BadFileName) UserClass::f(const String& filename) throw(BadFileName)
{ {
try { try {
File f(filename); File f(filename); // WARNING - unused
} }
catch (const AccessViolation& e) { catch (const AccessViolation& e) {
cout << " FULLY recover from access-violation\n"; cout << " FULLY recover from access-violation\n";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment