// Build don't link:
-#define NO_META_MAX
-#ifndef NO_META_MAX
template<int N1, int N2>
struct meta_max {
enum { max = (N1 > N2) ? N1 : N2 };
};
-#endif
struct X {
enum {
void foo()
{
C c;
- void * v = static_cast<void *>(c);
+ void * v = static_cast<void *>(c); // ERROR - illegal cast
}
+//Special g++ Options:
+//This uses GNU extensions, so disable -ansi
#include <stdio.h>
class A {
// Build don't link:
-/*
+/*
Check whether a typedef for a basic type as a baseclass is diagnosed.
*/
typedef int an_int;
-class bar : public an_int {}; // ERROR -
+class bar : public an_int {}; // ERROR - not an aggregate
class D {
int ins( B*&);
-};
+}; //WARNING - only private members
int
D::ins( B*& tempN)
enum T {
V1,
-}; // ERROR -
+}; //ERROR - comma at end of enumerator list
struct X {
T t : 31;
class foo {
public:
- operator <<(const void *);
- operator <<(char *);
+ operator <<(const void *); //ERROR - no return type
+ operator <<(char *); //ERROR - no return type
};
void main()
-{
+{ //ERROR - wrong return type for main
foo f;
f << (void*)0;
}
template <int n1>
double val <int> ()
-{
+{ // ERROR - bogus code
return (double) n1;
};
friend void operator<<(int, Foo const &) {}
};
template <unsigned X> class Bar : public Foo<X,int> {};
-inline Bar<0> bar(int,int,int) { return Bar<3>(); }
+inline Bar<0> bar(int,int,int) { return Bar<3>(); } // ERROR - no conversion
-template<int N> f<0>(){}
+template<int N> f<0>(){} // ERROR - invalid code
int main()
{
double f=Sine<32,5>()
- return 0;
+ return 0; // ERROR - parse error
}
static int variable; // this is intentionally duplicated
};
-myClass::variable = 0;
+myClass::variable = 0; //ERROR - no type
void f()
{
- extent(b);
+ extent(b); // ERROR - no matching function
}
class Bar;
-void main() {
+int main() {
ref_ptr<Baz> foo;
- static_cast<Bar *> (foo)->DoSomething;
+ static_cast<Bar *> (foo)->DoSomething; //ERROR - invalid cast
}