************************************* ERROR AND WARNING MESSAGES FILE ************************************* This file contains the Sun ANSI C++ compiler (ccfe) error and warning messages. It does not contain messages issued by the other components of the CC driver, such as the optimizer, code generator, or linker. The format for the messages is: o Message o Description o Example of code that generates the message o Message ID (tag) Not all messages have descriptions or code examples. There are two types of compiler messages: o Warning messages, in which the word "Warning" is displayed after the file name and line number, provide useful information without interrupting compilation. They may diagnose a programming error, or a violation of C++ syntax or semantics, for which the compiler nevertheless generates valid object code. o Error messages, in which the word "Error" prefix, cause the comiler command to fail. Errors occur when the compiler has diagnosed a serious problem that makes it unable to understand the program or to continue to generate correct object code. It attempts to examine the rest of your program for other errors, however. The compiler does not link your program if the compiler diagnoses errors. The phrase "Internal error, should not occur," followed by some message, usually does not diagnose a programming error, but rather a problem with the compiler. One of the compiler's internal consistency checks has failed. The problem diagnosed by the message issued is important; you can help Sun Microsystems, Inc. identify the problem by doing the following: 1. Run the CC command again with the same options as when it failed, plus the -P option. Output will be placed in a file with a .i suffix in your current directory. This file will help to identify the compiler problem. 2. Call your authorized service provider. You can find an authorized service provider by contacting your Sun Microsystems, Inc. reseller. *************************************

## Internal error, should not occur

This message is generated in the case of internal compiler error. Please note the circumstances surrounding the error and contact Sun (contact information).

Message ID: noerror

## integer overflow detected

The compiler attempted to compute the result of a floating addition at compile-time, and determined that the result overflows. The low-order 32 bits of the result are retained, and the compiler issues this diagnostic.

Message ID: addfovfl

## integer overflow detected

The compiler attempted to compute the result of an addition at compile-time, and determined that the result overflows. The low-order 32 bits of the result are retained, and the compiler issues this diagnostic.

Message ID: addovfl

## Redefining after use

The class has already used an outer scope name, and cannot redefine the name. Example of code that generates the error message:

    typedef int Integer;

    class A {
      Integer i;
      float Integer; //ERROR: redefining Integer after use in A
    };

Message ID: alreadyusedc

## Redefining template after use

The template has already been used locally, and cannot be redefined. Example of code that generates the warning message:

    template <class T>
    class A{};

    class B {
    	A<int> a1;
    	float A; // Warning
    };

    template <class T>
    class C {
    	A<float> a2;
    	long A;
    };
    C<int> ac; // Warning

Message ID: alreadyusedt

## The name is ambiguous

The name exists in both the base classes: %3 and %4. Use the scope operator to specify the one you want. Example of code that generates the error message:

    struct A {
            int i;
    };

    struct A2 {
            int i;
    };

    struct B: A, A2 {
            B() { i = 7; }
    	// ERROR: the name i is ambiguous in B: A::i and A2::i
    };

Message ID: ambigfield

## the base class is ambiguous

The base class is included in two or more of the base classes of a class. You must specify which one you mean. Example of code that generates the error message:

    struct B { int i; };

    struct B1: B {
      int j;
    };

    struct B2: B {
      int j;
    };

    struct A: B1, B2 {
      A() {
        i = 7; // ERROR: B::i ambiguous
        B1::i = 7; // ok
        B2::i = 7; // ok
      }
    };

Message ID: ambigbfield

## The base class is ambiguous

The base class is ambiguous: it was included on one or more bases. Example of code that generates the error message:

    struct A {
      int i;
    };

    struct B: A {
      int j;
    };

    struct C: A, B {
      int k;
      void foo() {
    	A::i = 10; // Error: The base class A is ambiguous in C.
      };
    };

Message ID: ambigbspec

## The name is ambiguous

The same name is found in two or more of the base classes. Specify which one you want. Example of code that generates the error message:

    struct B1 {
      void foo(){}
    };

    struct B2 {
      void foo(){}
    };

    struct A: B1, B2 {
        int i;
    };

    void bar()
    {
      A a;
      a.foo(); // ERROR
      a.B1::foo(); // ok
      a.B2::foo(); // ok
    }

Message ID: ambigname

## Anonymous unions cannot have function members

Anonymous unions cannot have function members. Example of code that generates the error message:

    static union {
            void foo(){} // ERROR
    };

Message ID: anonnofunc

## Anonymous unions cannot have private or protected members

Anonymous unions cannot have private or protected members. Example of code that generates the error message:

    static union {
            long j;

            private:
            	int i; // ERROR
    };

Message ID: anonnoprivate

## Global anonymous unions must be static

Global anonymous unions must be static Example of code that generates the error message:

    union { // ERROR
            long i;
            int j;
    	float k;
    };

Message ID: anonnotstatic

## A union member cannot have a user-defined assignment operator

It is illegal for a union member to have a user-defined assignment operator Example of code that generates the error message:

    class A {
    public:
      int i;
      A &operator =(A &la);
    };

    union B {
      A a;
      int i;
    };

Message ID: asgnotall

## has a reference member and cannot be assigned

Class has a reference member. Instance of such a class cannot be assigned to. Example of code that generates the error message:

    class A {
    public:
      int &i;
      int j;
      A(): i(j), j(5) {}
    };

    void foo()
    {
      A a1;
      A a2;
      a1 = a2; // ERROR: reference member i of instance a1 cannot be assigned
    }

Message ID: asgwref

## has a const member and cannot be assigned

The member is declared const, and cannot be assigned a value. Example of code that generates the error message:

    class A {
    public:
      const int i;
      A(): i(5) {}
    };

    void foo()
    {
      A a1;
      A a2;
      a1 = a2; // ERROR: const member i of instance a1 cannot be assigned
    }

Message ID: asgwconst

## Using as a template without a declaration

A template should be declared first. Example of code that generates the warning message:

    template class B<int>; // WARNING: B is not declared

Message ID: assumetemp

## Cannot change access

Access to a member cannot be changed this way. Example of code that generates the error message:

    class A {
     protected:
       int i;
    };

    class B : public A {
       public:
         A::i;  // ERROR:   cannot change access
    };

Message ID: badaccadj

## Cannot change access because of

Access cannot be changed because another class member exists. Example of code that generates the error message:

    class A {
     public:
         int i;
    };

    class B : public A {
       protected:
         int i;
       public:
         A::i;  // ERROR: cannot change access of A::i because of B::i
    };

Message ID: badadjname

## The operation is illegal

The unary operator is undefined for this object. To correct this, an overloaded unary operator may be defined for the type passed in. Example of code that generates the error message:

    class A {
    	int i;
    public:
    	//operator ++(); // prefix operator ++
    };

    void foo()
    {
    	A a;
    	a++; // ERROR: overload operator ++ to correct
    }

Message ID: badtunaryop

## The operation is illegal

The binary operation is undefined for this object. To correct this, you may overload the binary operator to take the arguments passed in. Example of code that generates the error message:

    class A {
       int i;
    };

    void foo()
    {
       A a, b;
       int i = a + b; // ERROR
       int j = a%b;	// ERROR
    }

    void bar() {
      int i = 9;
      float j = -9.3;
      i % j; // ERROR
    }

Message ID: badbinaryop

## Formal argument of type requires an lvalue

A non-lvalue was passed into the function that takes a reference. Example of code that generates the error message:

    int foo( int &i)
    {
      i = foo(1); // ERROR: "1" is not an lvalue.
      return 2;
    }

Message ID: badarglval

## Formal argument of type in call to requires an lvalue

A non-lvalue has been passed into the function that takes a pointer or an address. Example of code that generates the error message:

    int foo( int &i)
    {
      i = foo(1); // ERROR: "1" is not an lvalue.
      return 2;
    }

Message ID: badarglval2

## Formal argument of type is being passed

The argument passed into the function cannot be assigned to a parameter of the function. Example of code that generates the error message:

    void foo(int *cp);

    int main() {
      const char *cp = "abcd";
      foo(cp); // ERROR: const char *cp being passed to int*
    return 0;
    }

Message ID: badargtype

## Formal argument of type in call to is being passed

The formal argument in a function call cannot be assigned to a parameter of the function. Example of code that generates the error message:

    void foo(int *cp);

    int main() {
      const char *cp = "Hello";
      foo(cp); // ERROR: const char *cp being pass to int*
    return 0;
    }

Message ID: badargtype2

## Formal argument of type is being passed

The formal argument type in a function call does not match the parameter for the function. Example of code that generates the error message:

    class A {
    public:
      int i;
      A() { i = 1; };
    };

    void foo(A *Ap);

    int main() {
      const A *Ap = new A();
      foo(Ap); // ERROR: argument type A* being passed const A*
    return 0;
    }

Message ID: badargtypew

## String literal converted to char* in formal argument

The formal argument type in a function call does not match the parameter of the function. Example of code that generates the warning message:

    void foobar(char *c);

    void foo()
    {
    	const char *c = "abcde";
    	foobar(c); // warning, char* in call to foobar being passed const char*
    }

Message ID: badargtypelw

## Formal argument of type in call to is being passed

The formal argument type in a function call does not match the parameter of the function. Example of code that generates the warning message:

    class A {
    public:
      int i;
      A() { i = 1; };
    };

    void foo(A *Ap);

    int main() {
      const A *Ap = new A();
      foo(Ap); // warning: argument type A* being passed const A*
    return 0;
    }

Message ID: badargtype2w

## String literal converted to char* in formal argument in call

The formal argument type in an function call does not match the parameter of the function.

Message ID: badargtypel2w

## Illegal parentheses around an array initializer

An array initializer should be surrounded by curly brackets. Example of code that generates the warning message:

    static char a [5] = ("qwer");

Message ID: badarrinit

## A condition cannot have type

A syntax error encountered: wrong condition type. Example of code that generates the error message:

    void foo() {
       for ( ;int i[1] = (1); );    // ERROR: condition cannot have type int[1]
    };

Message ID: badcondtype

## Formal argument of type has an inaccessible copy constructor

Type has an inaccessible constructor. Example of code that generates the error message:

    class A {
      A(A& a) { };  // user defined private copy constructor
     public:
      A() {};
    };

    A the_a;

    void foo(A a) { };

    void bar() { foo(the_a); }; // ERROR: Formal argument a of type A in call to
                                // foo(A) has an inaccessible copy constructor

Message ID: badcopyacc

## Formal argument of type in call to has an inaccessible copy constructor

The object type of the formal argument in the function call does not have an accessible copy constructor. The formal argument cannot be copied to the new object. Example of code that generates the error message:

    class A {
      	A(A &a); // user defined private copy constructor
        public:
    	A();
    	void foo(A a);
    } a1, a2;

    int main() {
      a2.foo(a1); // ERROR: A(A&) is private.
    };

Message ID: badcopyacc2

## An array must have at least one element

The size in an array declaration cannot be zero or negative. Example of code that generates the error message:

    int ia[-5];
    int ib[0];

Message ID: badarraysize

## The operation is illegal

The object type is not an array type, and cannot use the array operator. Example of code that generates the error message:

    class A {
    public:
      //A operator[] (int);
    } a1, a2, a3[4];

    int main() {
      a1[7] = a2; // ERROR: a1 is not an array
      a3[4] = a2; // ok
    };

Message ID: badarraytype

## Cannot assign to

There is an assignment of an object to an incompatible type. Example of code that generates the error message:

    class A {
      int i;
    };

    void foo()
    {
      A a;
      int j;
      j = a; // ERROR: cannot assign A to int
    }

Message ID: badassignment

## Cannot assign without operator=

An explicit assignment operator should be provided. Example of code that generates the error message:

    class A { };

    class B {
        public:
            int operator = (int ) { return 0; }
            // the following operator should be defined in order
            // to get rid of error message:
            // int operator = (const A&);
    };

    int main () {
        A a;
        B b;

        b = a;
    }

Message ID: badasscasg

## The base must be a previously defined class or struct

The base class specified is not a previously defined class or struct. Example of code that generates the error message:

    class B;

    class A: B {}; // ERROR: the base "B" is not defined.

Message ID: badbaseclass

## Bit fields must be of an integral type

It is an error to have a bit field of a non-integral type. Example of code that generates the error message:

    static union {
        float c:3; //ERROR
    };

Message ID: badbftype

## This break is not in a loop or switch

`break` statements may not be outside `loop` or `switch` statements. Example of code that generates the error message:

    int main()
    {
    	int i = 5;

    	break;

    return 0;
    }

Message ID: badbreak

## Switch selection expression must be of an integral type

Only integral types may be used in a switch selection expression. Example of code that generates the error message:

    void foo()
    {
    	float i = 9;
    	switch(i) {	// ERROR: i is not an integral type
    		case 1:
    		case 9:
    			break;
    	};
    return;
    }

Message ID: badcasetype

## Cannot cast from to

The cast attempted is illegal. Use a constructor or a conversion function to convert. Example of code that generates the error message:

    class A {
            int i;
    };

    union B {
            int j;
            double k;
    };

    class C {
    public:
            int c;
            operator A();
    	operator int();
    };

    void foo() {
            B b;
            A a;
            C c;
            b = (B)a; // ERROR: cannot cast from A to B
            c = (C)a; // ERROR: Cannot cast from A to C.
    	a = A(c); // ok
    	int i = c; // ok
    }

Message ID: badcast

## Illegal character in a preprocessor directive

The preprocessor directive has used an illegal character.

Message ID: badchar

## Unexpected found

A syntax error has been detected. Example of code that generates the error message:

    void foo()
    {
        goto b: // ERROR: "b:" should be "b;"
    b:
    	return;
    }

    class B {
        public:
            int j;
            A anA;

        class A {
            public:
                int i;
        };
    };

    int main()
    {
      B aB;
      aB.anA:i = 1;  // ERROR: The ":" should be "."
    return 0;
    }

Message ID: badcolon

## Misplaced can only precede or follow a type qualifier

The scope operator did not precede or follow a type qualifier. Example of code that generates the error message:

    class B {
    public:
      static int i;
      static int j;
    };

    ::int i;      //  ERROR
    B::j = 9; // ok

Message ID: badcolon2

## must have tokens on both sides of it

There should be tokens on both sides of the ## operator. Example of code that generates the error message:

    #define foo(a)	abc ##       // ERROR

Message ID: badconcat

## Only a constructor can have constructor initializers

Only a constructor can have constructor initializers. Example of code that generates the error message:

    class B {
      int i;
      B(): i(5) {}  // ok
      void foo() : i(6) {} // ERROR
    };

Message ID: badconinit

## Using const_cast to convert from to not allowed

The const_cast conversion is illegal. The types are not compatible. Example of code that generates the error message:

    void foo()
    {
      int j = 5;
      const int i = j;
      int x = const_cast<int>(i); // ERROR: i is not an lvalue. Conversion from const int to int.
      int y = const_cast<float>(j); // ERROR: illegal const_cast conversion from int to float

      const int z = const_cast<int>(j); // ok: const_cast conversion of int to an int
    }

Message ID: badconstcast

## is not a valid constant

Syntax error. The constant is not valid. Example of code that generates the error message:

    int i = 2ooo; // ERROR
    int k = 0x9; //ok

Message ID: badconsterr

## The function cannot be declared

The error can be caused by a few cases: a non-member fuction has been declared const or volatile, or declaring a static member function const or volatile. MORE// Example of code that generates the error message:

    class A {
      static void foo() volatile {}; // ERROR
    };
    void foo() const {}; // ERROR

Message ID: badconstfunc

## A constructor may not have a return type specification

Constructors may not have a return type specification, including void. Example of code that generates the error message:

    class A {
    	int A(); // ERROR
    };

Message ID: badcontype

## There is no loop to continue

`continue` may only be used in a loop. Examples of loops include `while`, `for`, and `do-while`. Example of code that generates the error message:

    void foo()
    {
          int i = 5;
          if ( i > 4 ) {
    	   i = 4;
    	   continue; // ERROR: continue is not in a loop
          }
    }

Message ID: badcontin

## A conversion function may not have a return type specification

Conversion functions cannot have a return type specification. The operator type is sufficient to indicate what value is returned. Example of code that generates the error message:

    class A {
    	int j;
    	float f;
    	int operator int() { return j; };		// ERROR: return type may not be specified.
    	operator float() { return f; };		// ok
    };

Message ID: badconvtype

## User conversions to void are never used implicitly

User-defined conversions to type void are never used implicitly. A conversion to type void is illegal. Example of code that generates the warning message:

    class A {
    public:
    	operator void();		// Warning
    };

Message ID: wbadconvret

## Declaration terminated incorrectly

Syntax error encountered: declaration terminated incorrectly. Example of code that generates the error message:

    class A {
       void f() ; { }   // ERROR: declaration terminated incorrectly
    };

Message ID: baddeclerr

## There must be an identifier to declare

An identifier was expected during declaration parsing. It is likely that a lexical error was encountered during typedef declaration. Example of code that generates the error message:

    typedef *int my_type; // ERROR: stray star

Message ID: baddecl

## Each remaining parameter must have a default value

When declaring default values in the parameter list, all remaining parameters after the first default parameter must also have default values. Example of code that generates the error message:

    template <class T=long,
    	  class K> // ERROR: no default value
    class A {};

    void foo( int a,
    		float b,
    		long c = 6,
    		double e; // ERROR
    		int f = 2; )
    {}

Message ID: baddefault

## Invalid template parameter default

The template parameter default must be a defined or declared type. Example of code that generates the error message:

    template <class T, class K>
    class A;

    template <class T, class K = Eye>
    class A {
      int i;
    };

Message ID: baddefaultpar

## A template parameter may not be given default arguments by two different declarations in the same scope.

The same template declarations in the same scope with different default arguments is an error. Example of code that generates the error message:

    template <class T = int>
    class A;

    template <class T = long> // ERROR
    class A {
      int i;
    };

Message ID: sametmpldef

## Default arguments cannot be added in later declarations of the template function in the same scope

It is an error to add default arguments in later declarations of a template function in the same scope. Example of code that generates the error message:

    template <class T>
    T foo(T);

    template <class T>
    T foo(T = (T)9)  // ERROR
          { return T; }

Message ID: badtmplfundef

## The destructor name must match the class name

The destructor must have the same name as the class name.

Message ID: baddestrname

## A destructor may not have a return type specification

Destructors cannot have return types, including void. Example of code that generates the error message:

    class A {
      A();
      int ~A();
    };

Message ID: baddestrtype

## Unexpected else clause -- no preceding if

`else` must be preceded by an `if` statement. Example of code that generates the error message:

    void foo() {
           int i = 0;
           else	// ERROR: no preceding if
    	      i++;
    }

Message ID: badelseerr

## enumerator value overflows

The value for an enumeration constant overflows the maximum integer value. The maximum integer value is machine dependent. Example of code that generates the error message:

    #include <limits.h>

    enum e { e1=ULONG_MAX, e2 }; /* overflow for e2 */

Message ID: badenumrange

## Badly formed expression

There is a syntax error or errors in the expression. Example of code that generates the error message:

    int* foo() { return int[1]; }

Message ID: badexprerr

## Unknown language, must be C or C plus plus

The language specified with `extern` must be "C" or "`C++`". Example of code that generates the error message:

    extern "c" int i;  // ERROR: "c" should be "C"

Message ID: badextern

## was declared before with a different language

The function has already been declared before with a different language. Only one language version is allowed. Example of code that generates the error message:

    void foo();

    extern "C" void foo() {} // ERROR: foo() was declared as C++ previously

Message ID: badextlnk

## was declared before with a different language

A variable has been declared before with a different language. Example of code that generates the error message:

    extern "C" int i;
    extern "C++" int i;

Message ID: badextlnkw

## storage class %1 not allowed for a member

The storage class used is not allowed for a member. Example of code that generates the error message:

    class A {
    	register int j; // ERROR: storage class register not allowed here
    	extern int k;   // ERROR
    	auto   int l;   // ERROR
    };

Message ID: badfieldstore

## Badly formed include file name

The include file name is incorrectly formed. Example of code that generates the error message:

    #include 'includefile,h'
    #inlcude stdio.h

Message ID: badfilename

## The function should have a prototype before it is used.

A function should have a prototype before it is used. This message appears when the compiler is set to compile in C mode. Example of code that generates the warning message:

    int main () {
        return foo(); // WARNING: function should have a prototype (C mode only)
    }

Message ID: badfunc

## The function must have a prototype

A function must have a prototype or a function definition before it is used in a program. Example of code that generates the error message:

    int main()
    {
      goo(); // ERROR
    return 0;
    }

    void goo() {};

Message ID: badfunccp

## Functions must be static or external

Function storage types must be static or external. They may not be mutable, register, or auto. Example of code that generates the error message:

    static f1(); // ok
    extern f2(); // ok

    // The following are errors:
    mutable f1(); // "mutable" is not allowed outside a class
    register f2();
    auto f3();

Message ID: badfuncstore

## Functions cannot return arrays or functions

A syntax error encountered. Most likely, wrong return type was specified in a function declaration. Example of code that generates the error message:

    int a[] = {1, 2, 3, 6, 4, 5};
    typedef void bar();

    class A {
      bar goo(); // ERROR
      int foo()[] { return a; } // ERROR
    };

Message ID: badfunctype

## Goto bypasses a variable (or an exception) initialization

A variable was declared in a block bypassed by goto. Example of code that generates the warning message:

    int main()
    {
            int a = 2;

            goto next;
            int b = 3; // initialization of b was skipped
    next:
            a++;
    return 0;
    }

Message ID: badgoto

## Could not open include file

The include file was inaccessible or not found. It cannot be opened. Check the spelling of the include file name.

Message ID: badinclfile

## Extern variable cannot be initialized in a local scope

An extern variable may not be initialized inside a local scope. Example of code that generates the error message:

    extern int out = 2; // ok

    void foo()
    {
      out = 3; // ok
      extern int in = 9; // error
      extern int in2;
      in2 = 10; // ok
    };

Message ID: badinit

## Classes cannot be intialized with

The class is not an aggregate object. Only classes with no constructors, no private or protected members, no base classes, and no virtual functions may use bracketed initialization. Example of code that generates the error message:

    class A {
      int i;
      int j;
    };
    A a = {1, 2}; // ERROR: i and j are private.

Message ID: badinitcl

## Cannot use to initialize

You cannot use bracketed initialization for this object. Example of code that generates the error message:

    namespace N {
      int i;
      int j;
    }

    N n = { 1, 2 };

Message ID: badinitbrace

## Initializing requires an lvalue

An assignment to a reference must be made with an lvalue. Example of code that generates the error message:

    int &i = 3; // ERROR
    const int i = 0;
    int &ri = i; // ERROR: const int i is not an lvalue

    int j = 0;
    int &rj = j; // ok

    short sv = 9;
    int &ir = sv; // ERROR: assignment of short to an int reference "ir"
                  // requires that "ir" references an actual int.

The following is an example for correcting an error that was previously an anachronism.

    void foo() {
    	short sv = 9;
    	int &ir = sv; // ERROR: assignment of short to an int reference "ir"
            	      // requires that "ir" references an actual int.

The following code will correct this:

    	int *j;
    	*j = (int)sv;
    	int &jr = *j; // ok, "jr" is a reference to an int.
    }

Message ID: badinitlval

## Cannot use to initialize

The type used to initialize a variable is illegal. A constructor, conversion operator, or overload of the assignment operator may be used if this assignment is intended. Example of code that generates the error message:

    class A {
      int j;
    public:
      operator int() {return j; } // conversion operator for A
    };

    void foo() {
      A a;
      int i = a; // ok. Conversion form A to int provided
      a = new A(); // ERROR: using A* to initialize A
    };

    void bar() {
            int i = 9;
            char *a = &i; // ERROR: Cannot use int* to initialize char*
    }

Message ID: badinittype

## Cannot initialize array member in a constructor argument list

Array members cannot be initialized in a constructor argument list. Example of code that generates the error message:

    class A {
      int i[3];
      int j;
      A(): i(1,2,3),
           j(3) {};
    };

Message ID: badarrayinit

## The integer is too large to be represented

The integer is too large to be represented on this machine. Example of code that generates the error message:

    int i = 999999999999999999999999999999999;

Message ID: badinteger

## A line directive requires an unsigned decimal integer and a string

Line directives require an unsigned decimal integer. Example of code that generates the error message:

    #0x12 // ERROR
    #line 0xff "file.cc" // ERROR
    #line 12345 "file.cc" // ok

Message ID: badlinedir

## Line directives can only specify 1 to 32767

Line directives can specify integers from 1 to 32767 only. Example of code that generates the error message:

    #line 1234567 "file.cc"

Message ID: badlinenum

## was previously declared

An identifier has previously been declared with different linkage, and it is impossible to change it. Example of code that generates the error message:

    extern char * static_and_extern();
    static char * static_and_extern(); // ERROR: it was declared extern, not static

Message ID: badlinkage

## main() must have a return type of int

According to the standard, `main()` must have a return type of `int`. Example of code that generates the error message:

    void main() {}

Message ID: badmain

## Cannot take the address of main()

According to the standard, it is illegal to take the address of `main()` function. Example of code that generates the error message:

    int main()
    {
            int *a = main;
            return 0;
    }

Message ID: badmainaddr

## Cannot have a recursive call of main()

Recursive calls of main are not allowed. Example of code that generates the error message:

    int main()
    {
    	main();
    	return 0;
    }

Message ID: badmaincall

## Cannot overload main()

main() cannot be overloaded. Example of code that generates the error message:

    int main( int j) // ERROR: main () cannot be overloaded
    {
    	return 0;
    }

    int main()
    {
    	return 0;
    }

Message ID: badmainol

## cannot be initialized in a constructor

Members of the base class cannot be directly initialized by the derived class constructor initializer. Example of code that generates the error message:

    class B {
    	public:
    		int i;
    		int j;
    		B() { i = 0; j = 0; }
    };

    class A: B {
    	int k;
    	A(): i(7), j(5) {
    	// error on i(7), j(5) cannot be initialized in a constructor
    		B(); // ok, initializing with base class constructor
    		i = 7;
    		j = 9;
    	}
    };

Message ID: badmembinit

## Cannot call through pointer to member function before defining class

It is impossible to call a member function through the pointer to a member function until class body is defined. Example of code that generates the error message:

    class A;

    void (A::* f_ptr) ();

    int main () {
        A *a;
        (a->*f_ptr)();
    }

Message ID: badmfcall

## Member functions may not have storage class

A member function may have the storage classes `mutable`, `auto`, `register`, and `extern`. Example of code that generates the error message:

    class A {
      mutable void f1();  // ERROR
      auto void f2();     // ERROR
      extern void f3();   // ERROR
      static void f4();   // ok
      register void f5(); // ERROR
    };;

Message ID: badmfstore

## Octal constant contains an illegal digit

An octal constant may only have the digits 0 to 7. Example of code that generates the error message:

    int i = 08; // ERROR: 8 is an illegal digit for an octal number

Message ID: badoctal

## Only one of a set of overloaded functions can be extern C

Only one of a set of overloaded functions can be extern `"C"` Example of code that generates the error message:

    extern "C" int foo (char);
    extern "C" int foo (double); // ERROR: extern "C" function overloaded with extern
                                 //        another extern "C" function

Message ID: badollnk

## Illegal number of arguments

The overloaded operator has been declared with too many arguments. The number of parameters the operator takes cannot be changed. Example of code that generates the error message:

    class B {
      int j;
      B operator +(B, B); // ERROR: should be "B operator +(B)"
    };

Message ID: badopcount

## Cannot have a return type

The return types of the new and delete operators are incorrect. Example of code that generates the error message:

    #include <stddef.h>
    class A {
      A* operator new[] (size_t);  // ERROR: return type should be void*
      A operator delete[] (void*);  // ERROR: return type should be void
    };

Message ID: badoprtype

## Illegal parameter type

The parameter in the constructor or operator is not allowed. Example of code that generates the error message:

    class A {
    	 void operator delete[] (long* );  // ERROR: long* should be void*

    	A(A); // ERROR: the parameter in a copy constructor must be a reference to class type
    };

Message ID: badoptypes

## Bad parameter element

(Kernigan and Ritchie) An argument is declared but is not defined in parameter list Example of code that generates the error message:

    void foo (a,b)
        int a;
        char b;
        long d;     // Error: d is not defined in parameter list
    {}

Message ID: badparamerr

## The argument must be of type int

The overloaded postfix binary operator must take an int argument. Example of code that generates the error message:

    class B {
      B operator++(); // prefix ++b
      B operator++(float); // postfix b++,
                           //ERROR: should be B operator++(int)
    };

Message ID: badpostfix1

## The second argument must be of type int

The second argument of the postfix operator must take an int value. Example of code that generates the error message:

    template<class T>
    T operator ++(T &t, float); // ERROR: change float to int.

Message ID: badpostfix2

## Unknown preprocessor directive

The preprocessor directive is not recognized. Check the spelling. Example of code that generates the error message:

    #bad_directive

Message ID: badppdir

## Badly formed constant expression

A constant expression in a preprocessor directive was expected but not found. Example of code that generates the error message:

    #if 0xkl0   // ERROR: Badly formed constant expression.
    #fi

Message ID: badppexpr

## Simple types do not have destructors

Simple types such as `int`, `float`, and `char` do not have destructors. Example of code that generates the error message:

    int main() {
      int *i = new int(0);
      i->int::~int(); // ERROR: use "delete i" instead
    }

Message ID: badpseudodestr

## Non-virtual function declared pure

Only virtual functions may be declared pure. Example of code that generates the error message:

    class A {
    	A() = 0; // ERROR: A::A() is not virtual but is declared pure
    	virtual void foo() = 0; // ok
    };

Message ID: badpuref

## Bad syntax for pure function definition

A pure function requires that the function be declared virtual and set equal to 0. Any other syntax will generate an error. Example of code that generates the error message:

    class A {
    	A() = 0; // ERROR: A::A() not virtual
    	virtual void foo() = 1; // ERROR: "1" should be "0"
    	void foo() = 99; // ERROR: A::foo() not virtual

    	virtual void foobar() = 0; // ok
    };

Message ID: badpuresyn

## Different types

The second and third operands for "?:" are incompatible and cannot be converted.

    void foo()
    {
      int *x;
      int y;
      int i = (1 == 4 ) ? x : y; // ERROR
    }

Message ID: badquesttypes

## The floating constant is invalid

The floating constant is invalid. It is too large and will overflow, or does not have valid characters following the number (F, f, L, or l). Example of code that generates the error message:

    float i = 123.34f; // ok
    float j = 987.2g; // ERROR

Message ID: badreal

## Using reinterpret_cast to convert not allowed

`reinterpret_cast` is not allowed. Example of code that generates the error message:

    struct B { int j; };
    struct A: B { int i; };

    void foo() {
    	B *b = new A;
    	A *a1 = new A;
    	int *i = (int*)a1;

    	int j = reinterpret_cast<int> (*a1); // ERROR: cannot convert a1 to an int
    	a1 = (A*)i;  // ok, pointer types
    	b = (B*)a1; // ok
    	a1 = (A*)b; // ok
    }

Message ID: badreintcast

## Cannot return from a function that should return

The function returns a different type than the one specified by the function declaration. Example of code that generates the error message:

    class A{
    	A foo() {
    		char a = 'c';
    		return a;
    	}
    };

Message ID: badreturn

## Unexpected Check for matching parenthesis

An unexpected ")" was encountered. Example of code that generates the message:

    int main(){
    int i;
    ); // ERROR: unmatched right parenthesis

Message ID: badrparerr

## Using static_cast to convert not allowed

A static cast is legal only where there is an implicit conversion from one type to another. Example of code that generates the error message:

    struct A {
      operator int();
    } a;

    struct B {} b;

    void foo()
    {
      int i = 3;
      double d = 3.14159;

      i = d; // ok
      i = static_cast<int> (d); // ok

      static_cast<A> (i); // ERROR
      static_cast<B> (a); // ERROR

      int(a); // ok, conversion from type A to int provided
      static_cast<int> (a); // ok
    };

Message ID: badstaticcast

## The function cannot be static

The member function cannot be declared static. Example of code that generates the error message:

    #include <iostream.h>
    class A {
      static A foo();  // ok

      // The following are errors:
      static A();
      static A( int i, int j );
      static ~A();
      static A operator+(A a);
      static istream& operator>>(A& a);
    };

Message ID: badstatmf

## The function cannot be both virtual and static

A function cannot be declared both virtual and static. Example of code that generates the error message:

    class A {
      static virtual void foo();
    };

    class C {
      virtual void foo();
    };

    class D: C {
      static void foo(); // ERROR
    };

Message ID: badstatvirtf

## Undefined character escape sequence

The character escape sequence used in the string is not defined. Example of code that generates the error message:

    void foo()
    {
      char *a = "Hello World!\i"; // ERROR: "\i" undefined
    }

Message ID: badstring

## The value is too large to fit in a character

The character literal is too large a value to fit into a char type. Example of code that generates the error message:

    char c = '\xabc';
    int i = '\xabcdefg';

Message ID: badstringcon

## Illegal value for template parameter

Addresses of array elements and names or addresses of non-static class members are illegal template-arguments. A template argument must be an integral constant, or a pointer or reference to an external variable. Example of code that generates the error message:

    template<int* p> class X { };

    int a[10];
    struct S { int m; static int s; } s;

    X<&a[2]> x3;                    //  error: address of array element
    X<&s.m> x4;                     //  error: address of non-static member

Message ID: badtemparg

## Argument to template reference parameter must be an externally named object

The argument to the template reference parameter must be an externally named object. Temporaries or unnamed lvalues are illegal. Example of code that generates the error message:

    template <int &i>
    struct A {
      int &j;
      A();
    };

    int j = 9;

    void foo( int i ) {
      A<i> a1; // ERROR: i is a temporary

      extern int x[3];
      A< x[1] > a2; // ERROR: Address of array element is illegal
    		// for template parameter.

      extern int x;
      A<x> a3; // ok
      A<j> a4; // ok
    };

Message ID: badtmplrefarg

## Template parameters cannot have type

The template parameter type must be an integral type.

Message ID: badtemppar

## Operand for operator must be an lvalue

The operand to the unary operator must be an lvalue. Example of code that generates the error message:

    void foo() {
    const int x = 7;
    x++; // ERROR

    int j = --9; // ERROR
    }

Message ID: badunaryop

## Can only use this within a non-static member function

Only non-static member functions are allowed to use `this`. Example of code that generates the error message:

    class A {
      int j;
    public:
    	static void foo()  { this.j = 20*j; } // ERROR
    	void foobar() {this.j = 21*j; }; // ok
    };

Message ID: badthis

## The type specifier is not legal here

The type specifier is not allowed at this location.

Message ID: badtypeerr

## Virtual function returns while returns

The derived class has a virtual function with a different return type specified by the function in the base class. Example of code that generates the error message:

    class Base {
         virtual void foo();
    };

    class A: Base {
          int foo(); // ERROR: should return void
    };

Message ID: badvirttype

## A bitfield has bits

Too many bits specified for a bitfield. Most likely, the type of a bitfield is too small to have specified number of bits. Example of code that generates the error message:

    struct tag {
        char a: 32;     // Warning: char is too small to have 32 bits
    } t;

Message ID: bfbigger

## Bit fields may be no longer than bits

The declared bit field is too large. The size of the bit field is machine dependent. Example of code that generates the error message:

    static union {
        int a:33; // ERROR: Bit fields may be no longer than 32 bits (on this machine)
    };

Message ID: bftoobig

## Bit fields must contain at least one bit

Bit fields cannot be defined with less than a one-bit size. Example of code that generates the error message:

    class A {
    	int a:0; // ERROR: Bit fields must contain at lest one bit
    };

Message ID: bftoosmall

## Taking address of the bound function

Most likely, an attempt was made to assign member function pointer to a function pointer. Example of code that generates the error message:

    class A {
        public:
            A () { }

            int goo ();
    };

    int main () {
        A a;
        int (*foo) ();
        // The following declaration should be used instead:
        // int (A::* foo) ();

        foo = a.goo;
    }

Message ID: boundfuncaddr

## Cannot take the address of a constructor

Taking the address of a constructor is illegal. Example of code that generates the error message:

    struct A {
      A();
    };

    void foo()
    {
    	const int &i = A::A; // ERROR: cannot take address of a constructor
    }

Message ID: cantaddrcon

## Cannot take the address of a destructor

Taking the address of a destructor is illegal. Example of code that generates the error message:

    struct A {
      ~A();
    };

    void foo()
    {
    	const int & i = A::~A; // ERROR: cannot take address of a destructor
    }

Message ID: cantaddrdest

## The left operand cannot be assigned to

You are attempting to reassign a value of the left operand which was declared const and cannot be modified. Example of code that genreates the error message:

    const int i = 7;
    int j = 9;

    void foo () {
        i = j; // ERROR: The left operand cannot be assigned to
    }

Message ID: cantassign

## The operand cannot be assigned to

The operand cannot be modified. Constant values, array names, and functions cannot be assigned. Examples of code that generates the error message:

    int i = 7;
    int *const pi = &i;

    int j[5];
    j = 9;

    void foo() {}

    void goo() {
        foo = 5; // ERROR: The operand "*foo" cannot be assigned to.
        pi = &i; // ERROR: The operand "pi" cannot be assigned to.
    }

Message ID: cantassignop2

## Strings of differing character types cannot be catenated

Strings of wide character type and strings of character type cannot be catenated. Example of code that generates the error message:

    char str [] = "abcdefhg" L"hijklmnop";

Message ID: cantcatstring

## Cannot continue processing because of prior errors

This error is issued by the compiler when too many errors are detected to continue debugging the program.

Message ID: cantgoon

## An overloadable operator was expected

The overloaded operator specified was not found. This error can also be generated if the type of the operator has not yet been defined. Example of code that generates the error message:

    #include <stddef.h>

    class A {
    	void* operator anew[] (size_t); // ERROR: operator "anew" does not exist
    	void operator delete[] (void*);
    };

Example of an operator declared for an undefined type:

    class B {
      operator C(); // ERROR: the type C has not yet been defined
    };

    class C {};

Message ID: cantoverop

## Trying to take the address of the overloaded function

An overloaded function has a different address for each definition. Taking the address is ambiguous and is an error. Example of code that generates the error message:

    int foo() {return 1; }
    int foo(int i) { return 0; }

    int main()
    {
      const int & i = foo; // ERROR
      const int & j = foo; // ERROR
    return 0;
    }

Message ID: cantuseover

## Cannot cast away constness

There was an attempt to cast away constness. Example of code that generates the error message:

    class B { virtual void foo(); };

    class A: public B {};

    const B * pb = new A;
    A *pa1 = dynamic_cast<A*>(pb);  // ERROR: dynamic_cast casts const pb to a non-const pointer.

    int j = 4;
    const int *c = &j;
    int *i = reinterpret_cast<int*>(c); // ERROR

Message ID: xcastawayconst

## Type is incomplete, and casting from may be undefined

This error is currently not implemented. If a cast is from a struct that is incomplete and is not void, then this error is issued.

Message ID: castfrominc

## Type is incomplete, and casting to may be undefined

This error is currently not implemented. If a cast is to a struct that is incomplete and is not void, then this error is issued.

Message ID: casttoinc

## Cannot supply a default parameter for an exception handler

Exception handlers may not have a default parameter. Example of code that generates the error message:

    int main ()
    {
       int i = 3;

       try
       {
          if (i < 100)  throw 100;
       }
       catch (int j = 1000)  // ERROR
       {
          i += j;
       };
    }

Message ID: catchdef

## Handler for a derived class placed after handler for its base class

This warning generated in the case if a handler of the derived class placed after its base class handler. The second case will never catch an exception. The first case will match exceptions for instances of the base class and instances of the derived class. Example of code that generates the error message:

    class A {
    public:
      int i;
      A() { i = 1; }

    };

    class B: A {
    public:
      int j;
      B() { j = 2; }
    };

    int main ()
    {
       A a;
       B b;

       try
       {
          if ( b.j != 3)
    	  throw a;
          if ( a.i != 2)
    	  throw b;
       }
       catch (A anA)  // catches A and B exceptions
       {
         a.i = anA.i + 1;
       }
       catch (B anB) { // Warning: handler never reached
         b.j = anB.j + 1;
       };

    }

Message ID: catchderive

## Duplicate exception handler

There was more than one exception handler after `try`. Example of code that generates the warning message:

    int main ()
    {
       int i = 3, j = 4;

      try
       {
          if ( i == 3 || j == 4 )
    	  throw 5;
       }
       catch (int x)
       {
          i = x + 1;
       }
       catch (double z) // ok
       {
          i = j = i + j;
       }
       catch (int y )  // ERROR: Duplicate exception handler, same type
       {
          j = 2;
       };

    }

Message ID: catchdup

## Multiple exceptions for a handler

A handler may only have one exception. Example of code that generates the error message:

    int main() {
      int i = 3;
      double j = 4;

      try
      {
         if ( i != 3 )
            throw 3;
         if ( j != (double)4 )
            throw (double)4;
      }
      catch ( int x, double y ) // ERROR: Multiple exceptions for a handler
      {
         i = 3;
         j = 4;
      }
    return 0;
    }

Message ID: catchmularg

## No exception for a handler

The handler must have one exception. Example of code that generates the error message:

    int main() {
      int i = 3;

      try
      {
         if ( i != 3 )
            throw 3;
      }
      catch (  ) // ERROR: No exception for a handler
      {
         i = 3;
      }
    return 0;
    }

Message ID: catchnoarg

## A try block must have at least one handler

`try` must have at least one exception handler. Example of code that generates the error message:

    int main ()
    {
       int a = 107;

       try
       {
          if (a > 2000) throw 2000;
          if (a < 100)  throw 100;
          throw a / 3;
       }
       // ERROR: No catch
    }

Message ID: catchnosym

## A previously specified default argument value cannot be changed

Once a default parameter value has been specified, it cannot be redefined. Example of code that generates the error message:

    void foo( int i, int j = 7 ); // j has default value 7

    int main()
    {
    return 0;
    }

    void foo( int i, int j = 9 ) {}
    // ERROR: j has been defined to have default value to 7

Message ID: changedef

## Too many characters in character constant

The length of the character constant exceeds the maximum storage space of a `char`. Only the first four characters of a regular character constant, an only the first character of a wide character constant are used. Character constants longer than one character are nonpoartable. Example of code that generates the warning message:

    char c = '9999'; // ok
    char ch = '12345'; // ERROR

Message ID: chartoolong

## Cannot change a class or struct to a union

An object previously defined as a class or struct type cannot be redefined as a union. Example of code that generates the error message:

    class A {
      int i;
    };

    union A { // ERROR
      int i;
      long j;
    };

Message ID: cltounion

## Cannot change a union to a class or struct

An object defined as a union type cannot be redefined as a class or struct type. Example of code that generates the error message:

    union A {
      int i;
      long j;
    };

    class A {
      int i;
    };

Message ID: clfromunion

## Declarations are not allowed here

(C mode) In C, declarations are not allowed to be mixed with statements. Example of error that generates the error message:

    void foo () {
        int a = 0;

        a++;

        int c;      // Error: declaration is not allowed here
    }

Message ID: declplaceerr

## Vectors of classes must use the default initializer

Vector of classes must use only the default constructor. Example of code that generates the error message:

    class A {
         A() {};
    };

    typedef A B[5];

    void foo() { B b(1, 2, 3, 4, 5); }; // ERROR

Message ID: defaultonly

## Cannot define the type in a condition

Type definition within a condition expression is illegal. Example of code that generates the error message:

    int main () {
        for (int i = 0; struct t {}; j++)   // Error: 'struct t' couldn't be defined here
            ;
    }

Message ID: defincond

## The destructor is not accessible

The destructor of the class is private or protected and is not accessible from here. Example of code that generates the error message:

    class A {
    private:
            ~A();
    public:
            char *ch;
            A();
    };
    void foo() throw(A) {
        throw A();  // ERROR: destructor is not accessible
    }

    int main () {
        foo();
    }

Message ID: destnotacc

## was previously declared returning

The same function has been declared to return two different types. Example of code that generates the error message:

    void foo();
    int foo(); // ERROR: foo() previously returned void.

Message ID: difreturns

## Overflow in floating divide, deferred to runtime

The compiler has determined that the evaluation of the floating point division expression will overflow.

Message ID: divfovfl

## Attempt to divide by zero.

The compiler has determined that an integral value is being divided by zero and will overflow. Example of code that generates the error message:

    int i = 1/0;

Message ID: divovfl

## Attempt to divide by zero, deferred to runtime

There was an attempt to divide by zero, and the result is left to be handled at runtime. Example of code that generates the warning message:

    int i = 9;
    int j = i/0;

Message ID: divovflnv

## duplicate default in switch

There are two default statements in the current `switch` statement. Example of code that generates the message:

    f(void){
            long i = 5;
    	switch(i) {
    	case 1:
    	case 2:
    		    break;
    	default:
    	default:    // ERROR: too many default statements
    	}
    }

Message ID: doubdefault

## There are two consecutive underbars

The use of two consecutive underbars is a warning. The name may conflict with the internal names of compiler-generated code.

Message ID: doubunder

## This base class has already had the access specified

The access of the base class may be specified only once. Example of code that generates the error message:

    class B {};

    class D: public private protected B {}; // ERROR
    class G: public public {}; // ERROR

Message ID: dupaccess

## The base class is included more than once

A base class may be included only once. Example of code that generates the error message:

    struct A2 {
            int i;
    };
    struct A {
            int i;
    };

    struct A2 {
            int i;
    };

    struct B: A, A2, A { // ERROR: the base class A was included twice
            B() { A::i = 7; };
    };

Message ID: dupbaseclass

## duplicate case in switch

There are two case statements in the current `switch` statement that have the same constant value. Example of code that generates the error message:

    f(void){
            long i = 5;
    	switch(i) {
    	case 4:
    	case 4:
    		    break;
    	}
    }

Message ID: dupcaselabel

## The member was initialized before

The member has already been initialized previously in the constructor initializer list. Example of code that generates the error message:

    class A {
      int i;
      A(): i(0),
           i(0) { // ERROR: duplicate initialization of member i
      }
    };

Message ID: dupinit

## The result of dynamic_cast is not a pointer or reference type

The result of a dynamic cast must be a pointer or reference type. Example of code that generates the error message:

    class B {
      virtual foo();
    };

    class D: public B {
      int i;
    };

    B *pb = new D;

    D *pd1 = dynamic_cast<D>(pb); // ERROR, the cast does not result in a pointer or reference
    D *pd2 = dynamic_cast<D*>(pb); // ok

Message ID: dynbadtype

## The dynamic_cast operand must be a pointer or reference to a polymorphic type

A pointer or reference to a polymorphic type is required in the dynamic_cast operand. The type does not have at least one virtual function. Example of code that generates the error message:

    class B {};

    class D: public B {};

    B * pb = new D;
    D *pd = dynamic_cast<D*>(pb);  // ERROR: class B does not have a virtual function

Message ID: dynnotpolym

## The operand of a dynamic_cast is not a reference type

The result expected is a reference, but the operand is not a reference, a pointer, or a structure type. Example of code that generates the error message:

    class B { virtual void foo(); };

    class D: public B {};

    B *pb = new D;
    int &c = int j;

    D *pd1 = dynamic_cast<D&>(pb); // ERROR: The operand pb is a pointer
    D *pd2 = dynamic_cast<D&>(c);  // ERROR: c is not a structure type

Message ID: dynnotref

## The operand of a dynamic_cast is not a pointer type

The operand of the dynamic_cast was expected to be a pointer type. Example of code that generates the error massage:

    class B { virtual foo(); };

    class D: public B { int i; };

    B *pb = new D;
    D d;

    D *pd1 = dynamic_cast<D*>(d); // ERROR: d was expected to be a pointer type
    D *pd2 = dynamic_cast<D*>(pb); // ok

Message ID: dynnotptr

## The result of dynamic_cast is not a pointer or reference to a class

The target result of the dynamic cast is not a pointer or reference to a class. Example of code that generates the error message:

    class B { virtual void foo(); };

    class D: public B {
    };

    B *pb = new D;
    D *pd1 = dynamic_cast<int*>(pb); // ERROR: dynamic_cast should specify the type "D*"

Message ID: dynnotclass

## The operand of dynamic_cast is not a pointer or reference to a class

The operand does not point to a class type. Example of code that generates the error message:

    class B { virtual void foo(); };

    class D: public B {};

    int *c = int j;
    D *pd = dynamic_cast<D*>(c);  // ERROR: c points to an int

Message ID: dynbadopnd

## Multiple declaration

More than one object was declared with the same name. Example of code that generates the error message:

    int i;
    float i; // ERROR

    typedef int I
    //. . .
    int I; // ERROR

Message ID: multdecl

## Base class was initialized before

The base class has already been initialized. Example of code that generates the error message:

    class B {
      int i;
      B() { i = 0; };
    };

    class A: B {
      int i;
      A(): B(),
           B() { // ERROR: Base class initialized again.
      }
    };

Message ID: dupbaseinit

## has already been included in this declaration

Example of code that generates the error message:

    int const int i = 9;
    const float const j = 3;

Message ID: duptypeerr

## already had a body defined

A function may be defined only once. Example of code that generates the error message:

    void foo() { int i; }

    int main()
    {
    	/* code */
    }

    void foo() { int i; } // ERROR, foo() defined twice

Message ID: dupfuncdef

## This base class has already been declared virtual

There are too many virtual declarations for the base class. The base class needs only one virtual declaration. Example of code that generates the error message:

    class B {};
    class D: virtual public virtual B {}; // ERROR: too many virtual declarations.

Message ID: dupvirtspec

## catch(...) must be the last handler

"catch(...)" must be the last handler of the exception handler blocks. Example of code that generates the error message:

    int main ()
    {
       int i = 3;

       try
       {
          if (i < 100)  throw 100;
       }
       catch (...){} // ERROR: move this catch to the last of the catch statements
       catch (int j)
       {
          i += j;
       };
    }

Message ID: eliplaceerr

## Empty character constant

A character constant consisting of no characters has been used. Example of code that generates the message:

    f(void) {

    char c = '';    // suggestion: char c = ' ';
    }

Message ID: emptychar

## Empty declaration (probably an extra semicolon)

The code contains an empty declaration statement inside a namespace scope (which includes global and file scope). The most likely cause is an extra semicolon. Example of code that generates the message:

    namespace {
    ;  // ERROR
    };

    class A {
    ;
    }

Message ID: emptydecl

## A file must contain at least one external declaration

The file is empty. This error occurs if the file is not compiled as a `C++` file and the compiler is not in compatbility mode.

Message ID: emptyfile

## End of file encountered in a comment

The End of file was encountered before the end of a comment. Example of code that generates the error message:

    /*
    	message text . . .
    <EOF> // ERROR

Message ID: eofincomment

## End of file while skipping text -- Check #if .. #endif pairing

The compiler encountered the end of the file while skipping text. Check #if . . . #endif pairing. Example of code that generates the error message:

    #if false

    // . . . #if unmatched with #endif
    // <EOF>

Message ID: eofskipping

## This expression is too complicated

The expression has exceeded the maximum number of operands and operators allowed by this compiler. Try breaking down the expression into smaller intermediate expressions.

Message ID: exprtoomuch

## Trailing comma in a parameter list

The parameter list should not end with a trailing comma. Example of code that generates the warning message:

    void foo( int i, int j) {}

    int main()
    {
    	foo(1,2,); // ERROR
    return 0;
    }

Message ID: extracomma

## A member cannot be initialized except in a constructor

A member can only be initialized in a constructor. Example of code that generates the error message:

    struct A {
    	int i = 9; // ERROR
    	int j = 4; // ERROR
    };

    class B {
    	int k;
    	B() { k = 7; } // ok
    };

Message ID: fieldinit

## hides the function

The function in the derived class hides the function in the base class. Example of code that generates the warning message:

    class A {
    public:
      int foo(int);
    };

    class B: A {
    public:
       virtual int foo(char *i);
    };

Message ID: hidef

## hides

No ordinary operator delete was found in scope. Most likely, operator delete was illegally overriden in class scope. Example of code that generates the error message:

    #include <new>

    template<class t_arg> class A {
        public:
            void  operator delete(void*, const std::nothrow_t&) throw(); // ERROR: delete(void*) is hidden,
                                                                         // need to provide operator delete
                                                                         // with one parameter as well
    };

    int main () {
        A<int> * a = new A<int>;
    }

Message ID: hideferr

## hides the virtual function

A function in a derived class hides its counterpart in a base class. It usually happens if virtual function was redeclared in a derived class, and its prototype does not match that that was specified in a base class. Example of code that generates the error message:

    class B {
    public:
      virtual int foo(int); // hidden by B::foo()
    };

    class D: B {
    public:
      virtual int foo(char *i); // B::foo() hides virtual A::foo(int)
    };

Message ID: hidevf

## Hides the virtual function in a virtual base

Warning. A function is hiding a function in its virtual base class. Example of code that generates the warning message:

    class B {
      void i;
    public:
      virtual int foo(int); // hidden by B::foo()
    };

    class D: virtual B {
    public:
      virtual int foo(char *i); // Warning: B::foo() hides virutal A::foo(int)
    };

Message ID: hidevfinvb

## The name is unusable in a default parameter

The name is unusable as a default parameter in the current context. Example of code that generates the error message:

    void foo () {
        int a;

        class A {
            public:
                void goo (int b = a) {} // ERROR: a is unusable here
        };
    }

Message ID: identundef

## The name is unusable in

The name cannot be used in the specified context. Example of code that generates the error message:

    void foo () {
        int a;

        class A {
            public:
                void goo () {
                    int k = a; // ERROR: a is unusable here
                }
        };
    }

Message ID: identunnestf

## The name is unusable except in a non-static member function

Only a non-static member function may use this name. The member variable is not static. Each instance of the type will have its own copy. Example of code that generates the error message:

    struct A {
    	int i;
    };

    struct B: A {
    public:
    	int i;
    	static int j;

    	void foo() { B::i = 2; }	// ok
    	static foobar() { i = 2; }	// ERROR: "foobar()" is static, but "i" is not
    };

    void foobar() {
    	A a;

    	A::i = 7; // ERROR: A::i not static

    	B::j = 3; // ok
    	a.i = 7; // ok
    }

Message ID: identunstat

## Defining %1 within a cast is illegal

Defining a type within a cast expression is illegal. Example of code that generates the error message:

    int i;
    float j = ( class A{} ) (i);

Message ID: illegalcast

## is not accessible from

An attempt was made to directly access private members in a class. Example of code that generates the error message:

    class A {
            int i; // private data member
    };

    void foo() {
            A a;
            a.i = 9; // ERROR:  Error: i is not accessible from foo()
    }

    class T {
    	T(const T&); // private copy constructor
    };

    void foo( T t ) {}		// ERROR: cannot pass a T, copy constructor is private
    T f2() { T t; return t; }	// ERROR: cannot return a T

Message ID: inaccessible

## The type is incomplete

The type has not been defined correctly, or no storage has been allocated. Example of code that generates the error message:

    void i;  // ERROR: the type "void" is incomplete
    void *i; // OK, *i is a pointer type void

    class A;
    A a; // ERROR

    class B {
      friend void A::f(); // ERROR: f is a member of incomplete type
    };

    int xp[];   // ERROR: The type "int[]" is incomplete.
    struct x y; // ERROR: The type "x" is incomplete.
    int main()
    {
        xp [1] = 1;
        return 0;
    }

Message ID: incomplete

## The type, used in delete, is incomplete

The type used in delete still has not been defined. Example of code that generates the error message:

    class A;

    int main () {
        A * a_ptr = 0;
        delete[] a_ptr; // WARNING: The type A, used in delete, is incomplete
    }

Message ID: incompletew

## of type was previously declared

A variable of a different type has the same name as a variable with external linkage. Example of code that generates the error message:

    extern int i;
    float i; // ERROR

Message ID: incomtype

## was previously declared

(Kernigan and Ritchie): Function overloading is not allowing in Kernigan and Ritchie mode. Example of code that generates the error message:

    int foo (char);
    int foo (float); // ERROR: overloading is not allowed in KnR

Message ID: incomtypef

## A union member cannot require initialization or destruction

A union cannot have a member that requires initialization or destruction Example of code that generates the error message:

    class A {
        public:
            A();
    };

    union {
        A   a;  // ERROR: A union member cannot require initialization or destruction
    } un;

Message ID: initnotall

## has already been called and cannot be defined inline

Function cannot be defined inline since it has already been called and its declaration did not contain inline keyword. Example of code that generates the error message:

    class A {
        public:
            void foo ();
    };

    int main () {
        A a;
        a.foo();
    }

    inline
    void A::foo () {}

Message ID: xinlafteruse

## is too large and will not be expanded inline

The function is too large for the compiler to be generatedbe generated inline.

Message ID: inllargeuse

## is too large to generate inline, consider writing it yourself

The function is too large for compiler to generate automatically. You can still manually inline the function.

Message ID: inllargeint

## This label was never defined

A label was used, but was not defined. Example of code that generates the error message:

    int main()
    {
    	//. . .
            goto label1; // ERROR: "label1" was never defined
    	//. . .

    return 0;
    }

Message ID: labelundef

## A local class cannot have a static member

Static members cannot be declared in a local class. Example of code that generates the error message:

    void foo()
    {
            class A {
                    static int i;
            };

    }

Message ID: lcstatic

## Member functions in a local class must be defined in the class

You must define a body for a local class's virtual member functions. Example of code that generates the error message:

    int main () {
        class inner_class {
            public:
                virtual int foo ();     // ERROR
                virtual int goo () {}   // ok
        };
    }

Message ID: lcfnodef

## can only be used in a block or for a function argument

The storage classes `auto` and `register` may only be used in a block for a function argument. Example of code that generates the error message:

    register int a = 3;		// ERROR
    auto float b = 3.14159;	// ERROR

    void foo( auto int i,		// ok
    		register j )	// ok
    {
    	register int x = 3;	// ok
    	auto int y = 4;		// ok
    }

Message ID: locstorespec

## Linkage specifications are allowed only at file level

The linkage specification was not used at the file level. Example of code that generates the error message:

    extern "C" int k; //ok

    void foo() {
      extern "C" int i; // ERROR
      extern "C" int j; // ERROR
    };

Message ID: loclinkage

## String/char constants may not include line separator

A line separator is not allowed in string and character constants. Example of code that generates the error message:

    char c = '
    '; // ERROR: has line seperator.

Message ID: longstring

## Attempt to redefine without using #undef

Macros cannot be redefined to a different value without an intervening `#undef`. Example of code that generates the error message:

    #define count 1
    #define count 2 // ERROR:  Attempt to redefine count without using #undef.

Message ID: macroredef

## Too many parameters for this macro

This macro has exceeded the maximum number of parameters allowed by this compiler.

Message ID: manymacroparms

## The macro parameter is duplicated

There are two or more macro parameters with the same name. Parameter names must be unique. Example of code that generates the error message:

    #define foo( X, X )

Message ID: dupmacroparms

## Overloading ambiguity between and

The called overloaded function is ambiguous. Example of code that generates the error message:

    void foo (int i, int j);
    void foo (int i = 3, int j = 7);//  ok: redeclaration of  foo(int,   int)
    void foo ();                      //  ok: overloaded declaration of foo

    int main()
    {
    	foo (1, 2);                   //  ok: call  f(int, int)
            foo ();                       //  ERROR: call f(int,int)  or  f()?
    }

Ambiguity may also arise from use of constructors and conversion operators:

    struct A { A(int); };
    struct B {
    	B(int);
    	operator int();
    	operator double();
    } b;

    A foo( A a );
    B foo( B b );

    int main()
    {
      foo(1); // ERROR: foo(A) or foo(b)?
    }

    int i = b; // ok: conversion of B to int matches
    float f1 = b; // ERROR: call int or double operator?
    float f2 = double(b); // ok: conversion operator specified.

Message ID: manymatchover

## The class member cannot be declared outside the class

The class member cannot be declared outside the class. Example of code that generates the error message:

    class A {
        public:
    	void foo();
    };

    void A::foobar(); // ERROR: illegal declaration of member outside the class

Message ID: membnotall

## There are returns from with and without values

The function is declared to return a value but has returns with and without values. Example of code that generates the warning message:

    int foo() {
      int i = 9;
      if ( i == 1 ) return; // ERROR: foo() expected to return a value
      else if ( i == 2 ) return 8; // Warning: There are returns from foo() with and without values
      else if ( i == 3 ) return 1; // Warning
      else if ( i == 9 ) return; // ERROR
      else
        return 1; // Warning
    };

Message ID: mixedreturns

## Attempt to compute a remainder with zero

There was an attempt to compute a remainder with zero. Example of code that generates the error message:

    int i = 1000000 % 0;

Message ID: modovfl

## Attempt to compute remainder with zero, deferred to runtime

There was an attempt to compute a remainder of a variable with zero. The handling of this warning is left to runtime. Example of code that generates the warning message:

    void foo()
    {
    	int i = 9;
    	i%0;   // Warning: computing remainder with zero
    }

Message ID: modovflnv

## Overflow in floating multiply, deferred to runtime

The floating point multiplication expression was determined by the compiler to overflow. Handling of this error is deferred to runtime.

Message ID: mulfovfl

## integer overflow detected

The compiler attempts to compute the result of a multiplication at compile-time, and determines that the result overflows. The low-order 32 bits of the result are retained, and the compiler issues this diagnostic. Example of code that generates the message:

    int i = 1000000 * 1000000;

Message ID: mulovfl

## This name has multiple qualifiers, only one is allowed

Multiple qualifiers are not allowed.

Message ID: multqualerror

## The class is not a direct base class

The class is not a direct base class. The members of the class cannot be used by a base class directly. Example of code that generates the error message:

    struct B {
      int j;
      void foo() { /* B::foo() */ };
    };

    struct A: B { // B is the base class of A
      int i;
      void foo() { /* A::foo() */ };
    };

    A *pa;
    B *pb;
    A a;
    B b;

    int main() {
      pa = &a;
      pb = &b;

      pa->B::foo(); // ok
      pb->::foo(); // ERROR: A::foo() cannot be accessed by pointer type B
                    // of the base class
    return 0;
    }

Message ID: mustbebase

## The operator declared must be a member function

The operator declared must be a member function. The following operators must be defined as a member: "=", "->", "{", "()", and type conversions. Check if the scope operator is missing in the operator definition. Examples of code that generates the error message:

    class B {
      int i;
      operator =(const B&);
    };
    B::operator =(const B &b){ return (this->i + b.i); }; // ok, defined as member

    // The following will generate errors:
    B operator ->();
    B operator {();
    B operator ()();
    B operator int();

Message ID: mustbemem

## Cannot have an array of functions

A function cannot return an array of functions. Example of code that generates the error message:

    void foo[3] (); // ERROR

Message ID: noarroffunc

## Cannot have an array of references

An array of references is not allowed. Example of code that triggers the error message:

    int main() {
    	int &j;    // ok
            int &i[3]; // ERROR
    }

Message ID: noarrofref

## There is no base class to initialize

This class is not a derived class, and cannot initialize a base class. Example of code that generates the error message:

    class A {
      int i;
      A(): (10) {};
    };

Message ID: nobaseclass

## expected instead of

The statement is missing an "=". Example of code that generates the error message:

    void foo()
    {
        if ( const int i 2 ) // ERROR: there is a missing "=" after i
        ;
    }

Message ID: nobecomeserr

## Cannot take the address of a bit field

Taking the address of a bit field is illegal. Example of code that generates the error message:

    struct A {
      int i:3;
      int j:4;
      int k:5;

      int foo() { return &i; } // ERROR:
    };

Message ID: nobitaddr

## Cannot have a reference to a bit field

A reference to a bit field is illegal. Example of code that generates the error message:

    struct A {
      int i:3;
      int j:4;
      int k:5;

      int &foo() { int &ri = i; return ri;}  // ERROR
    };

Message ID: nobitref

## is not a member of

There was an attempt to access an object or function that is not a member. Example of code that generates the error message:

    void foo() {}
    void foobar() {}

    class A {
    public:
      int i;
      int j;

      friend void foo();
    };

    void A::goo() {}; // ERROR: goo is not a member of A

    int main()
    {
      A a;
      a.i = 0;    // ok
      a.foobar(); // ERROR: foobar is not a member of A
      a.foo();    // ERROR: foo is a friend but is not a member of A
    }

Message ID: nofieldfnd

## expected instead of

There is a syntax error. Example of code that generates the error message:

    void foo()
    {
    	int i = 0;
    	switch (i) {
    		case 3:
    		case 4; // ERROR ":" expected instead of ";"
    			i++;
    			break;
    	};
    };

Message ID: nocolonerr

## There was no following this

A ":" is expected following a "?". Example of code that generates the error message:

    int main()
    {
      int i= -7;
      i = ( i < 0 ) ? -i  i; // ERROR: ":" expected following "?"
    }

Message ID: nocolonop

## comma expected instead of

There is a syntax error in your code. Examples of code that can generate the error message:

    int foo( int i; int j) // ERROR: ";" should be ","
    {
      return i*j;
    }

    struct A {
      int k;
    } a, aa:
    // ERROR: "," followed by declaration is expected OR ":" should be ";"

Message ID: nocommaerr

## throw expression ignored when compiling with -noex

You have used the compiler argument `-noex` to ignore throw.

Message ID: noexthrow

## try and catch ignored when compiling with -noex

You have used the compiler argument `-noex` to ignore try and catch exception structures.

Message ID: noextry

## Identifier list expected instead of

The identifier list has an end of line before the list was terminated with a ")". Macros should be defined on one line. Is a "\" missing? Example of code that generates the error message:

    #define foo( A,  // Missing "\"
    	     B )

Message ID: noidentlist

## The constant member is not initialized

`const` member objects should be initialized.

Message ID: noconstinit

## No initializer allowed for new of an array

There is no way to provide an initializer while allocating an array with operator new[]. Example of code that generates the error message:

    class A {
        public:
            A (int k=0) {}
    };

    int main () {
        A * ptr = new A[2](3); // ERROR: there is no need to provide \'3\' as initializer
    }

Message ID: noconstrparm

## A declaration was expected instead of

The class definition must end with a semicolon or declarations followed by a semicolon. Example of code that generates the error message:

    struct A {
    	int i;
    } a, :

Message ID: nodeclerr

## No storage class or type for this declaration

The declaration does not specify a storage class or type. Example of code that generates the error message:

    class A {
    	i;	// ERROR: No storage class or type
    };

Message ID: nodeclspec

## Default parameters are not allowed

Default parameter values on overloaded operators or on pointers to functions are not allowed. Example of code that generates the warning message:

    class T {
      int i;
    public:
      T(int j);

    };

    T operator+ (T t, T t2= T(0) ); // ERROR: you cannot have default parameter values in overloaded operators.
    void (*fptr)(int k = 3); // ERROR: you cannot have default parameter values in pointers to functions

Message ID: nodefall

## A definition is not allowed in operator new

You cannot define any types within operator new. Example of code that generates the warning message:

    int main () {
        void * t = (void *) new (struct t {}); // ERROR: struct declaration in operator new
                                               // encountered.
    }

Message ID: nodefinnew

## A definition is not allowed in argument types

Functions cannot define a type in the arguments of a function. Example of code that generates the error message:

    class A {
      A();
      friend void foo( class B{} b;);
    };

Message ID: nodefinproto

## A type definition is not allowed in the return type

A type definition couldn't be used in the return type specification. Example of code that generates the error:

    struct t{} foo () {     // Error: 'struct t' couldn't be defined here
    }

Message ID: nodefinret

## A type definition is not allowed in a sizeof expression

You cannot define a new type within a "sizeof" expression. Example of code that generates the error message:

    int foo () {
        return sizeof (struct t {}); // ERROR: struct declaration in sizeof expression found
    }

Message ID: nodefinsizeof

## A type definition is not allowed in a typeid expression

You cannot define a new type within a "typeid" expression. Example of code that generates the error message:

    #include <typeinfo>

    int main () {
        typeid (struct t {}); // ERROR: struct declaration in typeid expression found
    }

Message ID: nodefintypeid

## Use of count in delete

The use of a count in the "delete []" operator is obsolete. Remove the count. Example of code that generates the warning message:

    void foo()
    {
      int *i = new int[10];
      delete [10] i;  // ERROR: use of count in "delete []"
    }

Message ID: nodelno

## No direct declarator preceding

Syntax error. A direct declarator is missing before this token. Example of code that generates the error message:

    int () {}; // ERROR: function name missing

    struct A {
    	static int i;
    	static int j;
    };

    void foo()
    {
    	A::i = 7; //ok
    	A:: ;  // ERROR: missing variable

    	int []; // ERROR missing array name
    }

Message ID: nodirdecl

## RTTI disabled, dynamic_cast replaced by static_cast

RTTI has been disabled, and dynamic casting is replaced with static casting.

Message ID: nodyncast

## is not an enumeration tag

A syntax error encountered after the keyword `enum`. Example of code that generates the error message:

    class A {
            enum A = { x, y, z }
    };

Message ID: noenumerr

## Expected an expression

An expression was expected but was not found. Example of code that generates the error message:

      int j =;
      int k = {};
      int l[] = {};
      if ( );

Message ID: noexprerr

## is not a member of

You tried to reference a nonexistent member of a class, structure or union. Example of code that generates the error message:

    struct {
    // The following field should be defined:
    // int a;
    } t;

    int main () {
        return t.a;
    }

Message ID: nofieldident

## A friend declaration must specify a class or function

The friend declaration did not have a class or function specified. Example of code that generates the error message:

    class A {
      int i;
      friend;
    };

Message ID: nofriendfield

## Class friends require an explicit class

Anachronism. Class friends require an explicit "class". Example of code that generates the warning message:

    class A {
      int i;
      friend B; // Warning: should be "friend class B"
    };

    class B {
      int j;
    };

Message ID: nofriendw

## Functions may not be part of a struct or union

A function cannot be declared as a structure member in Kernigan and Ritchie compatibility mode. Example of code that generates the error message:

    struct {
        int foo () { return 0; } // ERROR
    } t;

    int main () {
        return t.foo();
    }

Message ID: nofunchere

## Template and cast parameter lists must have

Template and cast parameter lists must have "<" matched with ">". Example of code that generates the error message:

    class B { virtual void foo(); };
    class A: public B {};

    int main()
    {
      B * pb = new A;
      A *pa1 = dynamic_cast<A*(pb); // "A*" should be immediately followed by a ">"
    }

Message ID: nogtrerr

## Identifier expected instead of

An identifier was expected. Example of code that generates the error message:

    void foo()
    {
    	int float j; // ERROR: identifier expected after int
    	int; // ERROR
    	goto; // ERROR
    }

Message ID: noidenterr

## Identifier expected instead of (warning)

(Kernigan and Ritchie, Ansi mode): an identifier was expected. Example of code that generates the error message:

    void foo()
    {
    	int; // ERROR
    }

Message ID: noidentwarn

## must be initialized

`const` values that are not external symbols must be initialized. Example of code that generates the error message:

    const int *pj = new int(0); //ok
    int a = 10;
    const int i;  // error
    const int &j; // error
    const int &k = a; // ok
    }

Message ID: noiniterr

## should be initialized

(Kernigan, Ritchie): `const` values that are not external symbols should be initialized. Example of code that generates the error message:

    int main () {
        static const int a; // WARNING: a should be initialized
    }

Message ID: noinitwarn

## Objects of type must be initialized

A const object created with the new() operator must be initialized either with an initial value, a constructor, or an initializer. Example of code that generates the error message:

    const int *ip = new const int; // ERROR
    const int *jp = new const int(0); // ok

Message ID: noinitanac

## The function has not had a body defined

A body was not defined for an inline function. Example of code that generates the message:

    inline void foo(); // ERROR: no function body is defined to inline foo()

    int main()
    {
    	foo();
    	return 0;
    }

Message ID: noinlbody

## The reference member is not initialized

The reference member must be initialized before it is used. Example of code that generates the error message:

    class A {
        public:
    	int &i;
    };
    void foo() {
    	A a;
    	a.i = 7;  // ERROR: "a.i" has not yet been initialized.

    	int j;
    	a.i = j;
    	a.i = 7;  // ok
    }

Message ID: noirefmem

## A statement (even if empty) is required after a label

A statement (even if empty) is required after a label. Example of code that generates the message:

    main() {
      int i = 10;
      switch (i) {
        case 1:
        default:
            i++;
            break;
        case 2:  // ERROR: label has no statement after "case 2"
      }
    }

Message ID: nolabstaterr

## left expected instead of

There is an error in the syntax. Example of code that can generate the error message:

    void foo()
    {
    	int i[] { 1, 2, 3, 4, 5 }
    }

    int main()
    int i;	// ERROR: a "{" was expected instead of "int"
    {
            return 0;
    }

    int foo()
    {
    	int m[] = 5; // ERROR: "{" expected instead of "5"
    	int n[] = { 2, 3, 5 }; // ok
    }

    class A {
    	int i;
    public:
    	A(): i(10); // ERROR: constructor should be defined
    	A(): i(10) {}; // ok
    };

Message ID: nolcurlerr

## Returning a reference to a local variable or temporary

The value being returned as a reference to a local variable or temporary may not be available outside the scope of the function. Example of code that generates the error message:

    int &foo(int i)
    {
       return i; // ERROR
    }

    int &foobar(int &i)
    {
       return i; // ok
    }

Message ID: nolocalname

## Cannot return a reference to a bit field

Returning a reference to a bit field is not allowed. Example of code that generates the error message:

    struct A {
      int i:3;
      int j:4;
      int k:5;

      int &foo() { return i; } // ERROR: cannot return a reference to a bit field
    };

Message ID: noretbitref

## Namespaces cannot be declared in a local scope

`namespaces` cannot be defined in a local scope. Example of code that generates the error message:

    namespace names { //ok
    	int j;
    	int k;
    };

    void foo() {
        namespace ns { // ERROR: namespace is in local scope
          int i;
        };
        ns n;
        n::i++;
    }

Message ID: nolocalns

## long long const not allowed with -nocx option

(ccfe): -nocx option prohibits using of both long long and long long const. Example of code that generates the error message:

    long foo () { return 0ll; } // ERROR with -nocx option

Message ID: nollconst

## long long not allowed with -nocx option

(ccfe): -nocx option prohibits use of both long long and long long const. Example of code that generates the error message:

    long long cll = 0;  // ERROR with -nocx option

Message ID: nolonglong

## long long bit fields are not allowed

bit fields of type `long long` are not allowed. Example of code that generates the error message:

    class a {
    	long long a:7; // ERROR: long long bit fields are not allowed
    	int b:4;
    };

Message ID: nollbitfield

## left round bracket expected instead of

"(" was expected in the expression but was not found. Example of code that generates the error message:

    int i;

    for i = 0; i < 7; ++i ) {} // ERROR: "(" expected instead of "i"

    if i < 7); // ERROR

Message ID: nolparerr

## left lt expected instead of

This error can be caused by a missing "<" in the cast expression or in the template. Example of code that generates the error message:

    class B { virtual void foo(); };
    class A: public B {};

    B *b = new A;
    A *a = dynamic_cast A*>(b);

    template class T>
    class D{};

Message ID: nolsserr

## Could not find to initialize base class

The base does not have a matching constructor to initialize the class. Example of code that generates the error message:

    class B {
    public:
    	int i;
    	 //B();
    	B(int x) { i = x; }
    };

    class A: B {
    	A() { // ERROR: base class default constructor B::B() not found
    	}
    };

Message ID: nomatchbase

## Could not find to initialize

An object in the class does not contain a matching constructor for the call. Example of code that generates the error message:

    class B {
    public:
    	int i;
    	 //B();
    	B(int x); // constructor supplied, no default constructor will be generated by compiler
    };

    class A {
    	B b_in_A; // not initialized
    	int i;
    	A(int x) { // ERROR: default constructor B::B() not found to initialize member b_in_A
    	i = x;
    	B(1);
    	}
    };

Message ID: nomatchmem

## Could not find a match for

A match of the function call among the overloaded functions and/or templates could not be found. Example of code that generates the error message:

    struct S { int &r; };
    int main() {
      struct S *x = new S(0); // ERROR: constructor S::S(int) not found
    };

    class A {
    public:
      int i;
      A();
      A(int a, int b);
    };

    void foo(){
      A a(1,2,3); // ERROR: passing three arguments to constructor, no match
    }

Message ID: nomatchover

## There is no matching right round

Every left parenthesis must have a matching right parenthesis. Example of code that generates the error message:

    int foo(   // ERROR: There is no matching ")"
    {
      int i = 3;
    reutrn 0;
    }

Message ID: nomatchrpar

## Cannot allocate with new

References and function types cannot be allocated with the `new` operator. Example of code that generates the error message:

    int main () {
        new (int&); // ERROR: attempt to allocate a reference with new
    }

Message ID: nonewtype

## can not find to initialize base class

The base class does not have a default constructor defined. If the base class has a constructor defined, a default constructor is not generated by the compiler.

    struct A { A(int); };
    struct C: A {};

    C c;    // ERROR
    C c1(); // ok, default constructor generated by compiler

Message ID: nonulconbase

## can not find to initialize field2

A member of a struct type does not have a default constructor, or a default constructor was not generated by the compiler because the contained type had at least one constructor supplied. Example of code that generates the error message:

    struct B {
      int i;
      B(int x);
    };

    struct A {
    	B b_in_A; // A does not have a default constructor.
    };

    A a; // error flagged here

Message ID: nonulcon

## Can not find to initialize a vector

The default constructor was not generated or defined. The vector could not be initialized. Example of code that generates the error message:

    class A {
    public:
      int i;
      //A();
      A(int);
    };

    A *a = new A[8]; // ERROR

Message ID: nonulvec

## Non-const function called for const object

A const object has called a member function that has not been declared const. Example of code that generates the error message:

    class A {
    public:
      A();
      int foo(int i)  {return i;}
    };

    void bar() {
      const int i = 7;
      A const a;
      a.foo(i);
    }

Message ID: nonconmf

## Pointer to non-const member function used with const object

A const object has called a member function that has not been declared const.

Message ID: nonconmfp

## A reference return value must be an lvalue

The function returns a reference value, but a non-lvalue has been returned. Example of code that generates the error message:

    int &foo()
    {
    	return 0;
    }

Message ID: nonvarref

## Casting a non-lvalue to

It is impossible to cast a non-lvalue to the specified type.

    int main () {
        const_cast<int&>(0);    // ERROR: cannot cast non-lvalue to int&
    }

Message ID: nonlvalcast

## The function cannot return a value

The function cannot return a value because the declared function return specification is void. Example of code that generates the error message:

    void foo()
    {
    	int i = 3;
    	return i;   // ERROR: the return type of the function is void, not int
    }

Message ID: nonvoidret

## Non-volatile function called for volatile object

An object declared to be volatile may only call a volatile function. Example of code that generates the error message:

    class A {
    public:
      void foo();
    };

    int main()
    {
      A volatile a;
      a.foo(); // ERROR: A::foo() is not a volatile function
    }

Message ID: nonvolmf

## Pointer to non-volatile member function used with volatile object

A member function must be declared volatile to be called by a volatile pointer. Example of code that generates the error message:

    class B {
    public:
      void bar();
    };

    void (B::* b_ptr)();

    int main()
    {
      B volatile *b;
      (b->*b_ptr)(); // ERROR: B::bar() is not declared volatile
    }

Message ID: nonvolmfp

## Use point or arrow to call

Member functions should be called by an instance of the class with "." or "->". Example of code that generates the error message:

    class A
    {
    public:
    	void foo(){ /* code */ }
    };

    int main()
    {
    	A::foo();
    }

Message ID: noobjcall

## Operand expected instead of

An operand was expected but was not found. Example of code that generates the error message:

    void foo()
    {
      int i = 2;
      int j[5];
      i = j[]; // ERROR: missing subscript
      i = [i]; // ERROR: should be j[i]
      double d = ()i; // ERROR: "()i" should be "(double)i"
    }

Message ID: nooprnderr

## Cannot subtract a pointer type from an integral type

A pointer type cannot be subtracted from an integral type. Example of code that generates the error message:

    void foo()
    {
      int i = 2;
      int *j = &i;

      i = i - j;
    }

Message ID: noptrsub

## Pointer type needed instead of

A pointer type of the object is required to access the member. Examples of code that generates the error message:

    class A {
       public:
    	int i;
    };

    void foo() {
    	A a;
    	a->i = 8; // ERROR: "a" is not a pointer type
    };

    void bar() {
    	int j;
    	j[0] = 7; // ERROR: "j" is not a pointer type
    }

Message ID: noptrvar

## right bracket expected instead of

There is a syntax error for the array subscript. Example of code that generates the message:

    int i[7];

    i[6} = 10; // ERROR: "]" was expected

Message ID: norbrackerr

## right curle expected instead of

"}" was expected but was not encountered. Example of code that generates the error message:

    int a [2] = { 1, 2 ; // Error, list of initializers should be terminated
                         // with "}"

Message ID: norcurlerr

## right curle expected instead of EOF

End of file was encountered before a matched "}" was found. Example of code that generates the error message:

    void foo()
    {
    	/* code */

    <EOF> // error, "}" was expected, but EOF was encountered

Message ID: norcurleof

## typeid or dynamic_cast ignored when compiling without RTTI support

Typeid and dynamic casting is disabled if the flag -feature=no%rtti is set.

Message ID: nortti

## Cannot define a reference or pointer to a reference

A reference or pointer to a reference is illegal. Example of code that generates the error message:

    const int &const &i = 12345678; // ERROR

    int i;
    int &ri = i;
    int &(*pri) = &ri; // ERROR

Message ID: noptrtoref

## Cannot declare a reference to

There was a declaration of a reference to void type. Example of code that generates the error message:

    void &foo(); // ERROR: declaring a return value of reference to void type

Message ID: noreftotype

## Cannot declare a reference to member type

It is illegal to declare a reference to a member type that would enable access to private or protected class member data.

Message ID: noreftomem

## Cannot take the address of a register

A register has no address. This error is triggered when the program is not compiled as a `C++` program and there was an attempt to take the address of a register. Example of code that generates the error message:

    register int i = 3;
    int *pi = & i;

Message ID: noregaddr

## right round parenthesis expected instead of

There was a syntax error. A ")" token was expected in the expression. Examples of code that can generate the error message:

    void foo()
    {
      int i = 3;
      switch (i	// ERROR: ")" missing
      {
    	 case 2:
    		i++;
    		break;
      };
    }

    void foobar( int i; float j ) // ERROR: "int i" should be followed by ","
    {
    	if ( i = 9)  // ERROR: "=" should be "=="
    		i++;

Message ID: norparerr

## Use semicolon to terminate statements

Statements must end with ";" Example of code that generates the message:

    int main()
    {
    	int i;
    	int j = 1;
    	i = j + 3  // ERROR

    return 0;
    }

Message ID: nosemierr

## Use semicolon to terminate declarations

Declarations must end with ";" Example of code that generates the message:

    volatile int foo
    int goo ()

Message ID: nosemiheaderr

## A statement (even if empty) is required here

A statement (even an empty statement) is required here. Example of code that generates the error message:

    void foo( int i ) {
    	if ( i < 10 )
    		++i;
    	else
    		// ERROR: missing statement
    }

Message ID: nostaterr

## A bit field may not be static

A static bit field is illegal. Example of code that generates the error message:

    class A {
      static int i:4; // ERROR
    };

Message ID: nostaticbf

## Variable is not a structure

The variable is not an instance of a structure. Example of code that generates the error message:

    int main ()
    {
    	int j;
    	j.novar = 7;
    return 0;
    }

Message ID: nostructsym

## The dot operator cannot be used on non-structure types

The dot operator cannot be used on non-structure types. Example of code that generates the error message:

    int main () {
        int().a;    // ERROR: int is not a structure type
    }

Message ID: nostructype

## The tag has already been used

The tag has already been used. Example of code that generates the error message:

    typedef int A;

    class A {};

Message ID: nostructerr

## is not a static data member

A static member is shared by all instances of the object type. This member is not static; therefore, you must specify which one to use by using an instance of the object. Example of code that generates the error message:

    struct A {
       int i;
       void foo() { A::i = 2; } //ok
    };

    A::i = 7; // ERROR, i not static

    void foo()
    {
    	A aa;
    	aa.i = 7; // ok
    }

Message ID: notastatmem

## is not a base class of

A base class name was expected in the `"using"` directive. Example of code that generates the error message:

    class t {
        public:
            int a;
    };

    class A {
        using t::a; // ERROR: t is not a base class of A, cannot use t::a
    };

Message ID: notbase

## An integer constant expression is required here

Syntax error: integer constant expression required. Example of code that generates the error message:

    int a;

    enum {
        mem1 = a,   // ERROR: an integer constant expression is required here
        mem2,
        mem3
    } e;

Message ID: notconst

## An integer constant expression is required for a case label

An integer constant expression is required for a case label. Example of code that generates the error message:

    int main()
    {
      int i = 0;

      switch (i) {
      case 4:	// ok
      case 3.141592654:	// ERROR
          i++;
          break;
      };
    };

Message ID: notconstcase

## An integer constant expression is required within the array subscript operator

The array subscript operator takes only an integer constant. Example of code that generates the error message:

    int e[7];
    e[2.718281828] = 5; // ERROR

Message ID: notconstsub

## An integer constant expression is required for a bit field

An integer constant expression is required for a bit field Example of code that generates the error message:

    class A {
      int a:2; // ok
      int b:6; // ok
      int d:3.141592654; // ERROR
    };

Message ID: notconstbit

## This construct is only allowed in C plus plus

The compiler has encountered code that is only allowed in `C++`, and has issued this warning.

Message ID: notcpp

## A typedef name cannot be used in an elaborated type specifier.

A typedef name cannot be used in enum and class types. Example of code that generates the error message:

    typedef struct S T;
    struct T *p; // ERROR

    enum x { a, b }
    typedef enum x y;
    y x;      // ok
    enum y x; // ERROR

Message ID: notdclass

## A function definition may not be a typedef declaration

A function definition cannot be a typedef'ed declaration. Example of code that generates the error message:

    typedef int(mft)(int i);
    mft foo
    {	// ERROR
       return i + 2;
    }

Message ID: notdfunc

## A class template name was expected instead of

Class template name was expected but not found. Example of code that generates the error message:

    int foo () { return 0; }

    template<> int foo(); // ERROR: foo is not a template class name

Message ID: notempname

## No parameters provided for template

A parameter is required in templated classes to specify the object type for which the template will be generated. Example of code that generates the error message:

    template<class T>
    class A {
      int i;
      T *data;
    public:
      A(int length=10) : data(new T[length]) {}
    };

    int main() {
      A a; // ERROR: template requires a parameter
    return 0;
    }

Message ID: notempparm

## No instantiation arguments provided for template

A template class was declared as taking a few arguments, but none of them were provided at the point of instantiation. Example of code that generates the error message:

    template <class A>
    class B {};

    template class B<>; // ERROR: template arguments must be provided

Message ID: notemparg

## Only a function may be called

Objects may not be called. Only a function may be called. Example of code that generates the error message:

    void foo() {}

    int main()
    {
    	int i;
    	i(); // ERROR: only a function may be called
    	foo(); // ok
    return 0;
    }

Message ID: notfunc

## A declaration does not specify a tag or an identifier

A tag or identifier is required in a declaration. Examples of code that generates the error message:

    int;
    float;
    enum E;

Message ID: nothingdecl

## The prior declaration for has an exception specification

According to the standard, operator new should have an exception specification. Example of code that generates the warning message:

    #include <new>

    // Correct declaration:
    // void* operator new(size_t) throw(std::bad_alloc);

    void * operator new (size_t); // ERROR

Message ID: nothrownew

## The prior declaration for has an exception specification (warning)

This operator previously had an exception specification. No exception will be thrown when this operator is called. Example of code that generates the warning message:

    #include <stddef.h>
    void* operator new[] (size_t); // warning: original operator new throws "std::bad_alloc"

Message ID: nothrowneww

## The prior declaration for has no exception specification

(Compatibility mode) Old-style new operator declaration does not use an exception specification. Example of code that generates the error message (in compatibility mode only):

    #include <new.h>

    void* operator new(size_t) throw(std::bad_alloc); // ERROR: exception specification is
                                                      // prohibited in compatibility mode
                                                      // for operator new

Message ID: nothrowold

## This case label is not in a switch statement

Case labels must be used only in switch statements. Example of code that generates the error message:

    int main()
    {
    	int i = 7;

    	case 7:		// ERROR: case statement is not in a switch statement
    		i++;
    		break;

    return 0;
    }

Message ID: notinsw

## This default label is not in a switch statement

Default labels are used only in switch statements. Example of code that generates the error message:

    int main()
    {
    	int i;

    	default:
    		i = 3;
    return 0;
    }

Message ID: notinswdef

## Right side must be a member pointer

The pointer used to the right of \".*\" or \"->*\" is not a member pointer.

    struct S {
    	  int i;
    };

    void foo()
    {
    	int y;
    	S cs;
    	int S::* pm = &S::i;	// pm refers to  member  S::i
    	cs.*pm = 88;	        // Ok
    	cs.*y = 88;		// ERROR: Not a member pointer
    					// Right side of ".*" or "->*" must be a member pointer

    }

Message ID: notmembptr

## The function resulting from can only be called

The function resulting from `.*` or `->` can only be called, it is impossible to obtain its address. Example of code that generates the error message:

    class A {
        public:
            void foo () {}
    };

    void (A::* f_ptr) ();

    int main () {
        A a;
        f_ptr = A::foo;
        a.*f_ptr;       // ERROR: function can only be called. Valid code is
                        //        (a.*f_ptr)();
    }

Message ID: notmembcall

## is not a namespace or class name

This error usually occurs when user attempts to create a namespace alias for a non-namespace. Example of code that generates the error message:

    struct not_a_namespace {};

    int main () {
        namespace alias=not_a_namespace; // ERROR: attempt to create an alias for structure
    }

Message ID: notnamespace

## is previously defined, but not a namespace

The identifier has already been used, and cannot be redefined as a namespace. Example of code that generates the error message:

    int n;

    namespace n {  // ERROR
            int i;
    };

Message ID: notnsname

## is defined but not used

The compiler has found declared objects that were not used in the code and issued this warning. Example of code that generates the warning message:

    void foo() {
        int i; // i not used
    }
    void foobar( int a,	// a not used
    	     int b )	// b not used
    {}

Message ID: notused

## type_info not defined

The file `typeinfo.h` should be included to use the `type_info` class if this is intended. Otherwise, it is suggested that a differnet name be chosen if it is anticipated that the program in the future may use the `typeinfo` class for RTTI support.

Message ID: notypeinfoh

## must be a class name, not a namespace name

The using declaration expects a class name that is a base class. The name used was a namespace. Example of code that generates the error message:

    namespace NS {int j; }
    //. . .

    class A: NS {
    	using NS::j;
    };

Message ID: nsnotall

## must be a namespace name, not a class name

The using directive expects a namespace name. The name used was a name of a class type.

    struct A{int j;};
    void foo()
    {
    	using A::j; // ERROR: namespace expected in a foo.
    }

Message ID: nsnotcl

## Label is not used

The compiler has found a label that was never used, and issued this warning. Example of code that generates the warning message:

    void foo() {
      int i = 0;
      goto b:
      a:
        --i;
      b:
        ++i;
    };

Message ID: labelnotused

## Type name expected instead of

A type name was expected but was not found. There are many cases that may cause this error. Examples of code that generates the error message:

    class A:   // ERROR: missing base class name
    {};

    struct B {
            int i;
    	j; // ERROR: Type name expected instead of "j"
    };

    struct D : B, { // ERROR: another base class name expected after the ","
            int j;
            D() :   { j = 10; };
            // ERROR: type name expected instead of "{", missing initializer
    };

    template <class T, class K>
    class A {};

    A<int, > a; // ERROR: missing type name after comma

Message ID: notypenameerr

## #define and #undef are not legal for predefined macros

Predefined macros are used by the compiler and cannot be defined or undefined.

Message ID: noundef

## A union may not have a base type

Unions may not have a base type. Example of code that generates the error message:

    class C {
    	int i;
    };

    union B: C { // ERROR
    	int j;
    };

Message ID: nounionbase

## The union may not be used as a base type

Unions may not have a base type. Example of code that generates the error message:

    union C {
    	int i;
    };

    union B: C { // ERROR
    	int j;
    };

Message ID: nounionasbase

## A union cannot have a virtual function

Unions cannot have virtual functions. Example of code that generates the error message:

    union A {
            int i;
            void foo() {};		// ok
    	virtual void foobar() {};	// ERROR
    };

Message ID: nounionvirt

## A value of type void is not allowed

The type data `void` is a non-value. Example of code that generates the error message:

    foo()
    {
      int i = (void)1;
    }

Message ID: novoidval

## Cannot dereference a void*

`void` pointers may not be dereferenced. A void has no value. Example of code that generates the message:

    void *i;
    int j = *i; // ERROR: cannot dereference a void*

Message ID: novoidderef

## while expected instead of

A `do` block must be ended with a `while` statement in a `do-while` loop. Example of code that generates the error message:

    void foo()
    {
    	int i = 0;
    	int j = 7;
    	do {
    	i++;
    	}  // ERROR: "while" expected instead of "}"

    	i = 0;
    	do {
    	i++;
    	} while ( i < j); // ok
    }

Message ID: nowhileerr

## Cannot have a using directive in a class

Using directives may not be used in a class. Example of code that generates the error message:

    namespace NS { int j; };

    class A {
      using namespace NS;
    };

Message ID: nsdirinclass

## Initializing to a NULL value

Reference initializtion expression is evaluated to zero. Example of code that generates the error message:

    static int zero;
    int& c = *(int*)0;  // Warning: reference initialized to zero

Message ID: nullref

## No base class or member name for initializer

Base initialization without a class name or member name is now obsolete. Example of code that generates the error message:

    struct A {
            int i;
    	A(int);
    };

    struct B: A {
            int j;
            B() : (3) { // ERROR
    	   	j = 7;
    	};
    };

Message ID: obsinit

## Other objects cannot be declared in a function definition

A function definition cannot declare other objects. Only class definitions may declare other objects. The declaration of a function along with an object will not trigger this error unless the function is trailed by another object declaration. Example of code that generates the error message:

    int 	i,
    	foo() { // ERROR: cannot declare an function here.
    		return 0;
    	} int j;

Message ID: onlyonefunc

## Integer overflow or division by zero

An expression has overflowed the size of an `int`, or a number was divided by zero.

Message ID: overflow

## Compiler out of memory

The compiler has run out of memory. Free some resources and try again.

Message ID: outofmem

## Partially bracketed initialization for

Initializing struct members without brackets will generate warnings when compiled with the "+w2" flag. Example of code that generates the error message:

    struct B {
      int i;
      int j;
    } X[] = { 1, 2, 3, 4 };

Message ID: partinit

## There is no prior #if corresponding to this directive

An `#else` directive must have a prior corresponding `#if` directive. Example of code that generates the error message:

    //#if true
    #define num 1
    #else num 0
    // . . .

Message ID: ppbadelse

## There is no prior #if corresponding to this #endif

The preprocessor directive `#endif` must have a corresponding `#if`.

Message ID: ppbadendif

## There is extra text on this line

There is extra text after the preprocessor command. Example of code that generates the error message:

    #include <file.h>; // ERROR: remove the extra ";"

Message ID: ppextra

## ANSI C does not allow extra text on this line - ignored

The extra text on this line is ignored in ANSI C.

Message ID: ppextraw

## Using as postfix operator

Only the prefix increment or decrement operator was declared. The postfix operator must also be declared before use. Example of code that generates the error message:

    class A {
    public:
    	int i;
            A operator ++(); // prefix operator++ declared
    };

    int main()
    {
    	A a;
    	a++; // ERROR: overload the postfix operator ++ to correct
    }

Message ID: postincdec

## Declare prior to use in function prototype

Structure and enum types should be declared prior to use in the function prototype. This message appears when the compiler is set to compile in C mode.

Message ID: protodec

## Cannot create a variable for abstract class

An abstract class of one or more pure virtual functions can only be used as a base class. You cannot directly create an instance of an abstract class. You must create objects of derived classes. Example of code that generates the error message:

    class A {
      virtual void foo() = 0;
      virtual int bar() = 0;
    };

    A a; // ERROR

Message ID: purealloc

## Cannot declare a member of the abstract type

An abstract type cannot be used as a member. If this member is a derived class, make sure this class has defined all the pure virtual functions in the base class. Example of code that generates the error message:

    class B {
      virtual void foo() = 0;
    };

    class X { B b; }; // ERROR: B is abstract

    template <class T>
    class Y {};
    Y<B> y; // ERROR

Message ID: puremem

## Cannot have a parameter of the abstract class

A parameter cannot be an abstract type.

Message ID: pureparm

## Cannot return a value of abstract class

The return type specification cannot be an abstract class. An abstract class has not been implemented, and cannot be used. If the return specification is a derived class, make sure this class has defined all the virtual pure functions in the base class. Example of code that generates the error message:

    class B {
      virtual B foo(B) = 0; // ERROR: foo(B) returns an abstract type
    };

    class A: B {};

    A bar() { // ERROR
      A *a;
      return *a;
    }

Message ID: purert

## Cannot create a value of the abstract class

A value cannot be created from an abstract class. Example of code that generates the error message:

    class A {
        public:
            virtual int foo () = 0;
    };

    class B : public A {
        public:
            virtual int foo () { return 0; };
    };

    int main () {
        B * b = new B();
        A& a = (A) *b;  // ERROR: A is the abstract class
    }

Message ID: pureval

## has not been overridden

The variable of the derived class of an abstract class has been instantiated before the pure virtual function of the base class has been overridden. Example of code that generates the error message:

    class B {
      virtual void foo() = 0;
    };

    class A: B {};

    A a; // ERROR

Message ID: puref

## may not have a type qualifier

A member function cannot be declared with a type qualifier to specify a different scope.

    class A {
    };

    class B {
      void A::foo(); // ERROR: cannot use type qualifier
      void B::goo(); // ok. goo() is declared in class B
    };

Message ID: qualnotok

## The only storage class allowed in a parameter list is register

Only the storage class `register` is allowed in a parameter list. `static`, `extern`, and `mutable` are not allowed. Example of code that generates the error message:

    class A {
        void foo( register int a,// ok
    	    mutable int b, // ERROR
    	    extern c,      // ERROR
    	    static int d,  // ERROR
    	    auto int e )   // ok
        {}
    };

Message ID: registeronly

## Anonymous union member has the same name as its containing class

An anonymous union member cannot have the same name as its containing class. Example of code that generates the error message:

    class A {
      union {
        int i;
        long j;
        int A;  // ERROR
      };
    };

Message ID: sameanon

## The enumerator has the same name as its containing class

An enumerator cannot have the same name as its containing class. Example of code that generates the error message:

    class A {
      enum e { A, B, C }; // ERROR
    };

Message ID: sameenum

## The static member has the same name as its containing class

A static member may not have the same name as its containing class Example of code that generates the error message:

    class A {
    	static int A;
    };

Message ID: samestatic

## The type has the same name as its containing class

You cannot define a type within a class of the same name. Example of code that generates the error message:

    class A {
        typedef struct { int a; } A; // ERROR: class A and typedef A have the same name
    };

Message ID: sametype

## An expression of scalar type was expected

The expression must be a scalar type. Example of code that generates the error message:

    class A {
    public:
      A() { i = 0; }
      int i;
      A foo() { return *this; }
    };

    void foo() {
      A a;
      if( a ){ // ERROR: scalar type expected, not type A
      }

      for( a.i;
           a;    // ERROR
           a.i++) {}
    }

Message ID: scalarexpected

## sizeof may not be applied to a bit field

`sizeof` may not be applied to a bit field. Example of code that generates the error message:

    class A {
    public:
      A() { size = sizeof(i); }
      int i:3;
      int size;
    };

Message ID: sizeofbf

## sizeof may not be applied to a function

`sizeof` cannot be applied to a function. It may only be applied to primative types, class objects, and expressions. Example of code that generates the error message:

    int i;
    int j;
    int foo(int k);
    int goo();

    k = sizeof (i*j*foo(10));	 //ok
    k = sizeof (unsigned int);	 //ok

    k = sizeof(foo);		 // ERROR
    k = sizeof(goo);		 // ERROR

Message ID: sizeoffunc

## Cannot have both static and notstatic versions

An overloaded funciton cannot have both static and notstatic versions. Example of code that generates the error message:

    class A {
      static void foo();
      void foo(); // ERROR
    };

Message ID: statnonconf

## The specifier is not allowed here

Syntax error. The specifier is not allowed here. Examples of code that generate the error message:

    inline class A{}; // ERROR
    virtual void foo(); // ERROR

    void foo() {
      virtual  void f1(); // ERROR
      friend void f2(); // ERROR
      explicit void f3(); // ERROR
    };
    void foo() {}

Message ID: storenotok

## is not allowed and is being ignored

The specifier used is not allowed here, and is ignored by the compiler. This message can also be issued if there was an attempt to typedef a template. Example of code that generates the warning message:

    template <class T> static class A; // Warning: "static" is not allowed and is ignored

Message ID: storenotokw

## Overflow in floating subtraction, deferred to runtime

The compiler has determined that the subtraction of the floating point numbers overflow, and it is deferred to runtime to be handled.

Message ID: subfovfl

## This case bypasses initialization of a local variable

A local variable is bypassed and cannot be initialized. Example of code that generates the error message:

    void foo()
    {
            int i=7;
            switch(i) {
            case 7:
                    break;
                    int j = 2;
            default:   // This case bypasses the initialization of the local variable j
                    i = 8;
            }
    }

Message ID: swuninit

## Template parameter requires a type argument

An invalid type or no argument was supplied for this template argument. Example of code that generates the error message:

    template <class T, class K>
    class B {
    public:
      T t;
      K k;
    };

    B<int> b1; // ERROR: B<T,K> requires another template argument
    B<int, 12345> b2; // ERROR: 12345 is not valid

Message ID: temargnotype

## Template parameter requires an expression of type

The expression does not match the type of the template parameter. MORE//No conversions are applied for a non-type template-parameter of type reference to object. Example of code that generates the error message:

    template <int i> class A {int i;};
    ;

    A<3.141593> a1; // ERROR: argument not an int
    A<3> a2; // ok

    template<class T, char* p> class D {
    	D();
            D(const char* q);
    };

    D<int,"penny"> x1; //  error: string literal as template-argument

    char p[] = "dime";
    D<int,p> x2;       //  OK

Message ID: temargnoval

## Null pointer conversion cannot be applied to template arguments

Actual parameters of the wrong type were passed as template parameters. Usually this means that NULL pointer was passed as a template parameter of pointer type - this will cause an error since NULL pointer conversion cannot be applied to template parameters. Example of code that generates the error message:

    template <char * i> class A {};

    int main () {
        A<0> a;
    }

Message ID: tempargnullptr

## Function templates may not have default template parameters

Default template parameters are allowed for class templates and class member functions only. Example of code that generates the error message:

    template <class T=int>
    T foo();

Message ID: temdefparms

## Non-type template parameters are not allowed for function templates

Non-type template parameters are not allowed for non-member functions. Example of code that generates the error message:

    template <int x>
    int foo();

Message ID: temfuncnontype

## Too many args in template, from on ignored

The template has too many arguments.

Message ID: temmanyargs

## Templates can only declare classes or functions

Templates are used for classes and functions only. Example of code that generates the error message:

    template <class T>
    int i;

Message ID: tempnotfunc

## Templates can only be declared at the global level

Templates can only be declared at the global level. Example of code that generates the error message:

    void foo() {
      int i;
      template <class T> class B { int j; }; // ERROR
    };

Message ID: temnotglob

## Templates nested too deeply (recursively?)

Templates may be nested 20 levels deep only.

Message ID: temtoodeep

## A qualifier is not allowed for

The member cannot be qualified.

Message ID: tdefqual

## The exception specification includes two of the same object types

The exception specification includes two of the same object types. Example of code that generates the warning message:

    void foo() throw(float i, float j);

Message ID: tltwice

## is not in the current exception specification

The exception specification has been changed from the declaration. Exception specifications must match. Example of code that generates the error message:

    void foo() throw(int i);

    // . . .

    void foo() throw(float i) {} // ERROR

Message ID: tnotinnew

## is not in the prior exception specification

The previous exception specification did not contain the current argument type. Exception specifications must match. Example of code that generates the error message:

    void foo() throw();

    // . . .

    void foo() throw(float i ) {} // ERROR

Message ID: tnotinold

## Too few arguments in call to

The call to the function has fewer arguments than the function declaration. Example of code that generates the error massage:

    void foo( int i, int j ) {}

    int main()
    {
         foo(1); // ERROR: not enough arguments in call to foo()
    return 0;
    }

Message ID: toofewargs

## Too few arguments in macro

The call to the macro has fewer arguments than in the macro definition. Example of code that generates the warning message:

    #define mask             0xffff00
    #define getField(data, mask)  data & mask // macro defined to take 2 arguments

    int field = getField( 1 ); // ERROR: call to macro has 1 argument

Message ID: toofewmargs

## Too few arguments for template

Template has more arguments than were provided. Example of code that generates the error massage:

    template <class A1, class A2> class B {};

    int main () {
        B<int> b;
    }

Message ID: toofewtargs

## Too many arguments in call to

The call to the funciton has more arguments than the function declaration. Example of code that generates the warning message:

    void foo( int i, int j ) {}

    int main()
    {
    	foo( 1, 2, 3 )
    return 0;
    }

Message ID: toomanyargs

## Too many arguments in cast to

Syntax error encountered, too many arguments have been passed to cast expression. Example of code that generates the error message:

    class A {
        public:
            operator long ();
    };

    int main () {
        long t = long(A(), 0); // ERROR: too many arguments in cast to long
                               // Should be:
                               // long t = long(A());
    }

Message ID: toomanycargs

## Too many arguments in macro

The call to the macro has more arguments than are defined by the macro. Example of code that generates the error message:

    #define mask             0xff0000
    #define getField(data,mask)  data & mask   // macro defined with 2 arguments

    int field = getField( 1, 2, mask ); // call to macro has 3 arguments

Message ID: toomanymargs

## Too many initializers for

Constructor initializers take only one parameter. Example of code that generates the error message:

    class A {
      int i;
      A(): i(1,2) {}
    };

Message ID: toomanynargs

## Too many arguments for template

There were too many arguments for the template. Example of code that generates the error message:

    template< class T, class K > // 2 template parameters
    class A {
      T t;
      K k;
    };

    A<int, float, long> a; // ERROR: 3 template arugments

Message ID: toomanytargs

## Access can only be changed to public or protected

Access level of a class member cannot be changed to private. Access can only be changed to public or protected. Example of code that generates the error:

    class A {
      public: int i;
    };

    class B: A {
      private: A::i;
    };

Message ID: topubliconly

## is initialized twice

A value has been initialized twice. Example of code that generates the error message:

    class A {
    public:
      static const int j = 9;
      A() {}
    };
    const int A::j = 9; // A::j initialized twice

Message ID: twoinits

## is too complex

The expression is too complex. Example of code that generates the error message:

    void foo(){
      int **************************i;
      **************************i = 9; // ERROR: too complex, 26 "*"
    }

Message ID: twtoocomp

## Unexpected type name encountered

The type name has not been defined prior to the use of the function or class. Example of code that generates the error message:

    template<class T>
    class A {
    	T t;
    };

    class B{
    	int i;
    };

    int main() {
    	A<float> a; // ok
     	B<int> b; // ERROR: template not defined for type B
    }

Message ID: typenotall

## The variable has not yet been assigned a value

A variable that has not yet been assigned a value has been used. Example of code that generates the warning message:

    void foo()
    {
    	int i;
    	i++;
    }

Message ID: unassigned

## is not defined

An identifier has been used but has not yet been defined. Example of code that generates the error message:

    void foo()
    {
      int i;
      j++; // ERROR: j is not defined
    }

Message ID: undefidenterr

## Template is not defined

Template must be defined before using it as template type parameter Example of code that generates the error message:

    template <t_arg<int> > struct tmp {};   // ERROR: t_arg is not defined

Message ID: undeftemperr

## The result of a comparison is unused

The result of a comparison is unused. Example of code that generates the warning message:

    void foo()
    {
      int i = 9;
      i == 9; // Warning: result unused
    	i++;
    }

Message ID: unusedcomp

## Constructors may not be virtual

Virtual constructors are not allowed. Example of code that generates the error message:

    class A {
            int a;
            virtual A(); // ERROR
    };

Message ID: virtconstr

## A virtual friend function needs a qualifying class name

A qualifying class name is required for virtual friend functions. Example of code that generates the error message:

    void foo() { return; }
    void goo() { return; }

    class A {
            virtual friend void foo();    // ERROR
    	virtual friend void A::goo(); // ok
    };

Message ID: virtfriend

## is expected to return a value

A function is expected to return a value but is returning void. Example of code that generates the error message:

    int foo()
    {
    	return; // ERROR: Return of type int expected
    }

Message ID: voidret

## The ampersand operator can only be applied to a variable or other l-value

The address-of operator can be applied to a variable or lvalue only. There must be an address to take. Example of code that generates the error message:

    int *i = &3; // ERROR: "3" is not an lvalue

Message ID: wantvarname

## ANSI C requires that bit fields be signed or unsigned int

Only signed or unsigned int bit fields are supported in ANSI C.

Message ID: wbadbftype

## was previously declared not

Operator new or operator delete should have a different linkage. Example of code that generates the warning message:

    #include <new>

    // WARNING: new should not be static (it was declared as extern).
    static void* operator new(size_t) throw(std::bad_alloc);

Message ID: wbadlinkage

## Empty declaration (probably an extra semicolon)

The declaration is empty. The most likely cause is an extra semicolon. Example of code that generates the error message:

    ; // Warning: no declaration

    namespace NS{}; // Warning: Namespace NS has extra semicolon at end

    }; // ERROR: the right parenthesis is unmatched

Message ID: wemptydecl

## A declaration does not specify a tag or an identifier

(Kernigan and Ritchie): A tag or identifier is required in a declaration. Examples of code that generate the error message:

    struct {};  // ERROR

Message ID: wnothingdecl

## Assigning to

There was an assignment of a type to an incompatible type. A constuctor, conversion function, or overloaded assignment operator may be required for class object types. Example of code that generates the warning message:

    class B {
    	int i;
    };

    class A: B {
    	int j;

    };

    void foo()
    {
    	A a;
    	B b;
    	a = b; // ERROR
    	b = (B)a; // ERROR: no constructor or no conversion function in A for type B

    	A *pa = &a;
    	B *pb;
    	pb = (B*)pa; // ok, pa* is cast to a pointer to a base class
    }

Message ID: wbadasg

## String literal converted to char* in assignment

The string literal was converted to a char* on assignment. Example of code that generates the warning message:

    void foo () {
        char *s;
        s  = "abcd"; // Warning
    }

Message ID: wbadasgl

## Using to initialize

Initializing a type with different type is a warning.

Message ID: wbadinit

## Using to initialize L

A string literal has been used to initialize a different compatible type.

    void foo()
    {
      char * s = "f"; // warning: using const char* to initialize an E
    }

Message ID: wbadinitl

## is expected to return a value

(Kernigan and Ritchie): The function is declared to return a value but does not. Example of code that generates the error message:

    int foo()
    {
    	return; // ERROR: foo() expected to return a value
    }

Message ID: wvoidret

## hides

The variable in the function hides a class member name. Example of code that generates the warning message:

    class A {
            int i;

            void foo() {
                    int i; // Warning: i hides A::i
            }
    };

Message ID: wvarhidemem

## hides the same name in an outer scope

The variable hides a variable name in outer scope. Example of code that generates the warning message:

    void foo() {
      int i;
      for ( int i = 0; // Warning: i hides variable in outer scope.
    	i < 10;
    	++i ){};
    }

Message ID: wvarhidenmem

## in #pragma init/fini should be void function with no args

You can pass only a void function with no arguments as a parameter to init or fini pragmas. Example of code that generates the error message:

    void my_fini (int a) { }
    #pragma fini(my_fini)

Message ID: prbadfunc

## Empty list in #pragma

Some pragmas require at least one parameter to be passed. Example of code that generates the error message:

    #pragma fini ()

Message ID: premptylist

## Invalid alignment; valid values are: 1,2,4,8,16,32,64,128

The alignment value must be a non-negative integral power of 2, but must be at most 128. Example of code that generates the error message:

    #pragma align 256 ( an_int, a_ptr, a_struct, a_class )

Message ID: prbadalign

## not declared as a function

Some pragmas require their arguments to be functions. Example of code that generates the error message:

    int my_fini;
    #pragma fini(my_fini)   // ERROR: my_fini is not a function

Message ID: prnotfunc

## referenced in #pragma should be global and previously declared

You should declare a function first if it appears in any pragma parameter list. Example of code that generates the error message:

    #pragma fini(my_fini)   // ERROR: my_fini should be declared first
    void my_fini (int a) { }

Message ID: prnotdecl

## Syntax error in pragma

Pragma statement is incorrect. Most likely, an obligatory pragma argument omitted. Example of code that generates the error message:

    int a, b, c;
    #pragma align (a, b, c)

Message ID: prsyntax

## String literal expected after #pragma ident

A string literal was missing after `#pragma ident`.

Message ID: prnostr

## Missing ',' in #pragma list

Wrong symbol was used as pragma argument's separator. Example of code that generates the error message:

    void my_init1 () { }
    void my_init2 () { }
    void my_init3 () { }

    #pragma init(my_init1,my_init2.my_init3)

Message ID: prnocomma

## Missing '(' in #pragma

Pragma parameter list should begin with '('. Example of code that generates the error message:

    void my_init1 () { }

    #pragma init my_init1)

Message ID: prnolp

## Missing ')' in #pragma

Missing ')' or wrong symbol in parameter list encountered. Example of code that generates the error message:

    void my_init1 () { }
    void my_init2 () { }
    void my_init3 () { }

    #pragma init(my_init1,my_init2.my_init3)

Message ID: prnorp

## line

This message is used by the compiler to display line numbers with error messages.

Message ID: linetheword

## No string in Asm statement

There must be a string literal in `asm` statements. Example of code that generates the error message:

    void foo()
    {
      asm( nop ); // ERROR
    }

Message ID: noasmstring

## Asm statement is not allowed outside a function

An `asm` statement is not allowed outside a function. Example of code that generates the error message:

    asm(" nop  "); // ERROR

    void foo()
    {
      asm(" nop "); // ok
    }

Message ID: asmnotinfunc

## Value expected for flag

Value was expected for the specified flag.

Message ID: cmd_needvalue

## Warning: The flag cannot be used with the flag

Some CC flags cannot be specified simultaneously (for example, +e0 and -compat=5).

Message ID: cmd_badflag

## No input file

This error is issued by ccfe when no input file is passed.

Message ID: noinpfile

## Could not open input file

The file passed to the compiler is missing or inaccessible and could not be opened.

Message ID: openinpfile

## Could not open output file

Preprocessor cannot open output file. Please check file permissions and/or free disk space.

Message ID: openoutfile

## Last line in file is not terminated with a newline

This warning indicates that the file does not end with a newline character.

Message ID: nonewline

## mutable is not allowed outside a class

The keyword `mutable` cannot be used outside a class. The mutable is used to enable modification of a field in a class object declared `const`. Example of code that generates the error message:

    void foo()
    {
    	mutable int i = 0; // ERROR
    }

    class A {
    	mutable int i; // ok
    };

Message ID: mutclassonly

## A function cannot be declared to be mutable

`mutable` can only be used for member data. Example of code that generates the error message:

    class A {
    public:
      mutable int i; //ok
      mutable void foo() {} // ERROR
      A() {}
    };

Message ID: mutnofunc

## Const names may not be declared mutable

`const` names cannot also be declared mutable. Example of code that generates the error message:

    class A {
    public:
      A(int j) { i = j; };
      mutable const int i; // ERROR
    };

Message ID: mutnoconst

## Only non-static data members may be mutable

A static data member cannot be made mutable. Example of code that generates the error message:

    class A {
    public:
      mutable static int i;
    };

Message ID: mutdatamems

## must be declared with language C plus plus

Overloaded operators must be declared with language `C++`

    class A {};
    extern "C" A& operator *(A&, A&);

Message ID: mustbecpp

## Complete class definition is not allowed in a friend declaration

A class definition cannot be specified in a friend declaration. Example of code that generates the error message:

    class A {
        friend class B {}; // ERROR: class definition in a friend declaration
    };

Message ID: nofrienddef

## No colon found following

The specification of the access level of class members was not followed by a colon. Private, protected, and public must be followed by a colon here. Example of code that generates the error message:

    class A {
      public	// ERROR:public not followed by ":"
      int i;
    };

Message ID: nocolaftacc

## End of file encountered in macro arguments

The end of file was found before the end of the macro arguments.

    #define foo( A, B, C )
    foo(1, 2,     // ERROR: missing argument.
    <EOF>

Message ID: eofinmargs

## Implicit int is not supported in C plus plus

Variables declared with an implicit int are not supported in `C++`. The type should be specified. Example of code that generates the warning message:

    i[] = {1, 2, 3};

Message ID: noimplint

## Expected class or struct before

A class key was expected in the template declaration. This error can also be caused by an incorrect function template declaration that appears to be a class template declaration. Example of code that generates the error message:

    template <class T> A // ERROR: class key is missing
    {
      int i;
      int j;
    };

    template <class T> foo : /* . . . */ ; // ERROR

Message ID: noclasskey

## The local type cannot be used as a template argument

Locally defined types cannot be used as template arguments. Example of code that generates the error message:

    template <class T>
    class A{};

    void foo()
    {
    	class B {};
    	enum E {one, two, three};
    	A<B> a1; // ERROR
    	A<E> a2; // ERROR
    }

Message ID: nolocaltarg

## A template argument cannot be an unnamed type.

A template argument cannot be an unnamed type. A type also cannot be defined in the template argument at the same time. Example of code that generates the error message:

    template <class T>
    class A {
      T t;
    };

    A<class{}> a;	// ERROR: The struct has no type name.
    		// To use a user defined type, define the type before use.

Message ID: nounnamedtarg

## Unexpected in an initializer list

A syntax error has been detected while parsing a constructor initializer list. Example of code that generates the error message:

    class A {
        int a;
        long b;
        int c[2];

        A() : a(0) : b(0) {}    // ERROR: unexpected ':' in initializer list
    };

Message ID: unexpinitl

## Bad class file format, dead code

This is an internal message used by the Java Native Compiler

Message ID: jdeadcode

## Could not find file

This is an internal message used by the Java Native Compiler

Message ID: jnoclass

## Could not find definition

This is an internal message used by the Java Native Compiler

Message ID: jnomember

## Bad class file format, constant pool entry

This is an internal message used by the Java Native Compiler

Message ID: jbadcpool

## Bad class file format, type code

This is an internal message used by the Java Native Compiler

Message ID: jbadtcode

## Bad class file format, illegal byte code

This is an internal message used by the Java Native Compiler

Message ID: jbadbcode

## Export ignored -- not yet implemented

`export` has been ignored. It has not yet been implemented.

Message ID: exportnotimpl

## Template keyword missing

The keyword `template` was not found before "<" in the template declaration. Example of code that generates the error message:

    export <class T>  // ERROR
    class A{};

Message ID: notemplkey

## Old explicit specialization syntax

The old explicit specialization syntax has been found and this warning is issued. The new explicit specialization syntax is as follows: template-id: template-name < template-argument-listopt > template-name: identifier template-argument-list: template-argument template-argument-list , template-argument template-argument: assignment-expression type-id id-expression

Message ID: oldexpspecial

## Explicit non-class, non-function instantiation/specialization not yet implemented

Explicit non-class, non-function instantiation/specialization has not yet been implemented in this compiler.

Message ID: noexpimpl

## Infinite recursion in use of operator->

The class has overloaded the "->" operator. The operator returns a value of class type. Example of code that generates the error message:

    class A {
    public:
      int j;
      A operator->(); // returns an A
    };

    void foo() {
      A a;
      a->j = 9; // ERROR
    };

Message ID: recurarrow

## The overloaded operator should return a pointer

The overloaded operator-> should return a pointer to an object of class type. Example of code that generates the error message:

    class B {
    public:
      int j;
      B operator->(); // returns an B
      B& operator->();
    };

    void foo() {
      B b;
      b->j = 7; // ERROR: ambiguity, operator->() returns B
    };

Message ID: recurarrow2

## Questionable return type for

The overloaded "->" operator should return a pointer to an object of class type. Example of code that generates the warning message:

    class A {
    public:
      int* operator->(); // Warning A::operator->() returns int*
      int k;
    };

Message ID: arrowrtn

## Cannot cast from

Casting between function pointers and object pointers has undefined results, but on Solaris does not lose information.

Message ID: badcastw

## An anonymous union in a class may not be

An anonymous union in class may not have some specifiers such as extern, static, and the like. Example of code that generates the error message:

    class A {
        static union {  // ERROR: anonymous union may not be static
            int a;
            long b;
        };
    };

Message ID: badclanon

## Namespaces cannot be declared in a class scope

Namespace declaration within a class is not allowed Example of code that generates the error message:

    class A {
        namespace ns {} // ERROR: namespace declaration in a class scope
    };

Message ID: noclassns

## Template parameter may not be redeclared in this scope

Template parameter may not be redeclared in this scope. Most likely, a template parameter's name was used in a declaration within a template scope. Example of code that generates the error message:

    template <class t_arg> class A {
        int t_arg;      // ERROR: template parameter t_arg redeclared
    };

    int main () {
        A<int> a;
    }

Message ID: templparamdecl

## Template parameter may not be used in an elaborated type specifier

Using a template parameter in an elaborated type specifier is prohibited. Example of code that generates the error message:

    template <class t_arg> class A {
        class t_arg {};     // ERROR: template parameter t_arg used in elaborated type specifier
    };

    int main () {
        A<int> a;
    }

Message ID: templtypedecl

## Illegal syntax for elaborated type specifier

Syntax error encountered. Example of code that generates the error message:

    template <class t_arg> class A {};

    typedef class A<int> my_type;   // ERROR: Illegal syntax ...

Message ID: badelabtype

## Value for pragma pack must be a power of two

The valid values for pragma pack must be a power of two. Example of code that generates the error message:

    #pragma pack (3)

Message ID: prbadpack

## Template declarations cannot have extern C linkage

It is impossible to declare a template with extern C linkage. Example of code that generates the error message:

    extern "C"
    template <class t_arg> class A {}; // ERROR: template declaration cannot have this linkage

Message ID: temnotexternc

## Type names qualified by template parameters require typename

A `typename` keyword is required when type names are qualified by template parameters Example of code that generates the error message:

    class A {
        public:
            typedef int my_type;
    };

    template <class t_arg> class B {
        public:
            typedef t_arg::my_type my_type; // WARNING
    };

    int main () {
        B<A>::my_type c;
    }

Message ID: typenameass

## Ambiguous cast from

The cast is ambiguous. Example of code that generates the error message:

    class A {};

    class B : public A {};
    class C : public A {};

    class D : public B, public C {};

    int main () {
        D *d = new D;
        A *a = (A*) d; // ERROR: D contains two A instances
    }

Message ID: ambigcast

## Friend declaration of template not allowed

Template cannot be declared as friend without specialization. Example of code that generates the error message:

    template <class t_arg> class A {};

    class B {
        friend class A; // ERROR: friend template declaration. Should be:
                        // friend class A<int>;
    };

Message ID: nofriendtmpl

## friend declaration is incompatible with function template

Template function cannot be declared as friend. Example of code that generates the error message:

    template<class t_arg> int foo () { return t_arg; }

    class A {
        friend int foo<int>(); // ERROR: template function cannot be friend
    };

Message ID: nofunctmpl

## Global scope has no declaration for

A function declared to be a friend has not been found in global scope. Example of code that generates the error message:

    class A {
        friend int ::foo ();    // ERROR: foo is not declared in global scope
    };

Message ID: noglobaldecl

## Warning: The flag cannot be used with the flag

Some CC flags cannot be specified simultaneously (for example, +e0 and -compat=5).

Message ID: cmd_badflag_wrn

## Error: The flag cannot be used with the flag

Some CC flags cannot be specified simultaneously (for example, -memtmpl and -compat=5).

Message ID: cmd_badflag_err

## Cannot have a non-constant reference to a bit field

A reference to the bit field is non-constant Example of code that generates the error message:

    struct C {
            int x : 2 ;
    };

    C oc;
    int & xref = oc.x;   // ERROR: xref is a non-constant reference

Message ID: varbitref

## Cannot open library for reading pre-instantiated symbols

Cannot open a file specified by the option -preinstlib=<file-name>.

Message ID: openinstlib

## Cannot read symbols from pre-instantiated library

Cannot read symbols from a file specified by the option -preinstlib=<file-name>.

Message ID: readinstlib

## Member functions may not be declared with template type parameters

An attempt was made to declare a member fuction using a function type template parameter. Example of code that generates the error message:

    template <class T> struct X { T t; };

    typedef int F();
    X < F > m1; // ERROR: cannot delcare 't' as a int t().

Message ID: badtmplfunctyp

## Template non-type arguments cannot have type

A template-argument for a non-type, non-template template-parameter cannot have given type. See ISO C++ Standard 14.3.2 for details. Example of code that generates the error message:

    template<class T, int I> class X { };

    X<int, 2.7> x;

Message ID: badtmplexparg

## A string literal is not an acceptable template argument

A string literal (lex.string) is not an acceptable template-argument because a string literal is an object with internal linkage. See ISO C++ Standard 14.3.2 for details. Example of code that generates the error message:

    template<class T, char* p> class X { };

    X<int,"String"> x;

Message ID: tmplexpstrlit

## An address of an array element is not an acceptable template argument

Addresses of array elements and names or addresses of non-static class members are not acceptable template-arguments. See ISO C++ Standard 14.3.2 for details. Example of code that generates the error message:

    template<int* p> class X { };

    int a[10];

    X<&a[2]> x;

Message ID: tmplexpaddarr

## Ambiguous partial specialization for

User specifies actual template argument list that matches more than one partial specialization. Example of code that generates the error message:

    template<class T1, class T2, int I> class A             { };

    template<class T1, class T2, int I> class A<T1*, T2, I> { }; // #1
    template<class T1, class T2, int I> class A<T1, T2*, I> { }; // #2

    A<int*, int*, 2> a5; // ambiguous: matches #1 and #2

Message ID: ambigpartial

## No primary specialization for partial specialization

There is no primary specialization before partial specialization. The user should always supply primary specialization in order to declare or define partial specialization. Example of code that generates the error message:

    template<class T>            class A<T, T*>   { };

    template<class T1, class T2> class A          { };

Message ID: psnoprimary

## Partial specialization may not have default parameters

The template parameter list of a specialization shall not contain default template argument values. Since there is no way in which they could be used. Example of code that generates the error message:

    template<class T1, class T2> class A             { };
    template<class T = int>                  class A<T, T*>   { };

Message ID: psdefaults

## Nontype parameter may not be used as part of an expression

Nontype parameter may not be used as part of an expression. Example of code that generates the error message:

    template<class T, int p, int c> class X { };

    template<class T, int p > class X<T, p, p + 5> { };

Message ID: psntinexpr

## Partial specialization has identical arguments

The partial specialization should not has arguments identical to the primary specialization, since there is no use of such a construct. Example of code that generates the error message:

    template<class T1, class T2>  class A           { };
    template<class T1, class T2 > class A<T1, T2>   { };

Message ID: pssameargs

## The type of specialized argument is dependent on another argument.

The type of a template parameter corresponding to a specialized non-type argument shall not be dependent on a parameter of the specialization. Example of code that generates the error message:

    template< int X, int (*array_ptr)[X] > class A {};

    int array[5];

    template< int X > class A<X,&array> {};

Message ID: psargdeptype

## Partial specialization parameter is not used in the arguments

User supplies one or more partial specialization parameters and do not use them in the specialization itself. Example of code that generates the error message:

    template<class T1, class T2> class A             { };
    template<class T, class T2>  class A<T, T*>      { };

Message ID: psargnotused

## Partial specialization is not implemented

This message is issued when user explicitly switch the partial specialization handling off. Example of code that generates the error message (in compatibility mode only):

    template<class T1, class T2> class A          { };
    template<class T>            class A<T, T*>   { };

Message ID: psnotimp

## Cannot use a certain identifier in a 'using' declaration

Example of code that generates the error message:

    class B
    {
    public:
        B() : i(0) { }
        ~B() { }
        int i;
    };

    class D : public B
    {
    public:
        using B::~B; // error - using cannot refer to destructor
        D() : j(0) { }
        int j;
    };

    int main()
    {
        return 0;
    }

Message ID: usingdestr

## tdb_version Template Database is incompatible with this compiler

Compiler encountered a SunWS_cache directory that is incompatible with this compiler. This error is produced when an older compiler encounters a template database produced by a newer compiler. Use the newer compiler to compile the sources, or use `CCadmin -d -clean` to clean that template database.

Message ID: tdb_version

## duplicate -I- option, ignored

More than one -I- option was found on the command line.

Message ID: duplicate_i

## badexplctinst Failed to find a template to match the type deduced in explicit instantiation

Example of code that generates the error message is:

    template < class T > void copy ( T to ) { }

    template int copy ( long ) ;    // Error!

Message ID: badexplctinst

## samemem Class member has the same name as its class

Example of code that generates the error message is:

    struct x {
        x();
        int x;
    };

Message ID: samemem

## badenumsize Taking size of a member of incomplete enumeration

The sizeof operator shall not be applied to an enumeration type before all its enumerators have been declared. Example of code that generates the error message is:

    int mymain()
    {
        enum E { A, B = sizeof A }; // error - can't apply sizeof A yet
        return 0;
    }

Message ID: badenumsize

## badarrptr Assignment of pointers to incompatible array types

In `C++`, it is incorrect to assign a pointer to complete array type to a pointer to incomplete array type, and vice versa. Example of code that generates the error message is:

    extern int a_39W73zz[2];   // size is known
    int (*p2)[] = &a_39W73zz;  // error - mismatched type, size is unknown for `p2`.

Message ID: badarrptr

## Function \"%1\" with incomplete return type \"%2\", compiler cannot generate virtual table in this situation.

Compiler cannot handle situation when return type of the virtual function is a struct type with no definition and rejects the code. Example of code that generates the error message is:

    struct Fum; // incomplete type
    struct B {
            Fum virtual f();
    };
    struct D : virtual B {
            D();
    };
    D::D() { }

Message ID: incompletert

## Cannot change access

Access to a member cannot be changed this way. This is a warning in compatibility mode but an error in standard mode. Example of code that generates the error message:

    class C {
    private:
        class inner;
    public:
        class inner { }; // redeclaration with different access
    };

Message ID: badaccadjw

## Overloading ambiguity between and

The called overloaded function is ambiguous. Example of code that generates the error message:

    void foo (int i, int j);
    void foo (int i = 3, int j = 7);//  ok: redeclaration of  foo(int,   int)
    void foo ();                      //  ok: overloaded declaration of foo

    int main()
    {
    	foo (1, 2);                   //  ok: call  f(int, int)
            foo ();                       //  ERROR: call f(int,int)  or  f()?
    }

Ambiguity may also arise from use of constructors and conversion operators:

    struct A { A(int); };
    struct B {
    	B(int);
    	operator int();
    	operator double();
    } b;

    A foo( A a );
    B foo( B b );

    int main()
    {
      foo(1); // ERROR: foo(A) or foo(b)?
    }

    int i = b; // ok: conversion of B to int matches
    float f1 = b; // ERROR: call int or double operator?
    float f2 = double(b); // ok: conversion operator specified.

Message ID: manymatchover_w

## is not accessible from

An attempt was made to directly access private members in a class. Example of code that generates the error message:

    class A {
            int i; // private data member
    };

    void foo() {
            A a;
            a.i = 9; // ERROR:  Error: i is not accessible from foo()
    }

    class T {
    	T(const T&); // private copy constructor
    };

    void foo( T t ) {}		// ERROR: cannot pass a T, copy constructor is private
    T f2() { T t; return t; }	// ERROR: cannot return a T

Message ID: inaccessible_w

## extra \";\" ignored

Extra semicolon detected at the end of a field declaration Example of code that generates the warning message:

    struct S {
            int ii;;
            void f();;
    };

Message ID: fieldsemicolonw

## cannot take address of a temporary

Cannot take address of a compiler generated temporary. Example of code that generates the warning message:

    struct C { C(int); };
    void add( C *c );
    void foo() { add( &C(6) ); }

Message ID: addressoftemp

## storage class is not allowed in a friend declaration

Example of code that generates the warning message:

    struct A {
            friend static void foo(A arg);
    };

Message ID: storeclassfriend

## Enum name %1 used as scope qualifier

Example of code that generates the warning message:

    class C {
                C::C();
                enum E { a, b } e;
    };
    C::C() {
                switch(e) {
                    case E::a:       // <-- fails here
                    break;
    	    }
    }

Message ID: enumasscope

## statement is unreachable

The statement is never reached. Example of code that generates the error message:

    int foo(int x) {
      if ( x > 0 )
    	return 1;
      else
    	return 2;
      return 3;	// Warning: statement is unreachable
    }

Message ID: wunreachable

## The last statement should return a value

The last statement of a non-void function should return a value. Example of code that generates the error message:

    int foo(int x) {
      if ( x > 0 )
    	bar();  // Warning: The last statement should return a value
      else
    	return 2;
    }

Message ID: wnoretvalue

## The else-branch should return a value

The else-branch of an if statement should return a value. Example of code that generates the error message:

    int foo(int x) {
      if ( x > 0 )  // Warning: The else-branch should return a value
    	return 2;
    }

Message ID: wnoelseretvalue

## An anonymous struct in a class may not be

An anonymous struct in class may not have some specifiers such as extern, static, and the like. Example of code that generates the error message:

    class A {
        static struct {  // ERROR: anonymous struct may not be static
            int a;
            long b;
        };
    };

Message ID: badclanonstruct

## An anonymous struct has same name

An anonymous struct member cannot have the same name as its containing class. Example of code that generates the error message:

    class A {
      struct {
        int i;
        long j;
        int A;  // ERROR
      };
    };

Message ID: sameanonstruct

## An anonymous struct cannot have private member or protected members

Anonymous structs cannot have private or protected members. Example of code that generates the error message:

    static struct {
            long j;

            private:
            	int i; // ERROR
    };

Message ID: anonstructnoprivate

## An anonymous struct cannot have member functions

Anonymous structs cannot have function members. Example of code that generates the error message:

    static struct {
            void foo(){} // ERROR
    };

Message ID: anonstructnofunc

## Anonymous struct is being declared

Example of code that generates the warning message:

    union U {
        struct {
            int a;
            long b;
        };
    };

Message ID: anonstruct

## Forward enum type is being declared

Example of code that generates the warning message:

    enum  A;

Message ID: forwardenum

## declaration conflicts with introduced by using declaration

If a function declaration in namespace scope or block scope has the same name and the same parameter types as a function introduced by a `using` directive, the program is ill-formed. Example of code that generates the error message:

    namespace B {
        void f(int);
    }

    namespace N {
        using B::f;             //  introduces B::f(int) into N
        void f(int);            //  error: N::f(int) conflicts with B::f(int)
    }

Message ID: ambigdecl

## Union can not contains a member of reference type

If a union contains a member of reference type, the program is ill-formed. Example of code that generates the error message:

    union x {
        int &i;
    };

Message ID: nounionref

## Shift count is too large

Example of code that generates the warning message:

    unsigned long l;
    void foo()
    {
            l >> 32; // should get a warning
    }

Message ID: largeshift

## cannot take address of a temporary

Cannot take address of a compiler generated temporary.

Message ID: compataddressoftemp

## Cannot initialize enumeration with an integer

Example of code that generates the warning message:

    enum E { e1 = 5 };
    struct S { E e; } s = { 5 }; // warning

Message ID: wintenuminit

## Function %1 can throw only the exceptions thrown by the function %2 it overrides

Function can throw only the exceptions allowed by the function it overrides Example of code that generates the error message:

    struct A
    {
            virtual void foo() throw(A);
    };

    struct B : A
    {
            virtual void foo();
    };

Message ID: lessrestrictedthrow

## hides

No ordinary operator delete was found in scope. Most likely, operator delete was illegally overriden in class scope. Example of code that generates the error message:

    #include <new>

    template<class t_arg> class A {
        public:
    	void  operator delete(void*, const std::nothrow_t&) throw();
    };

    int main () {
        A<int> * a = new A<int>;
    }

Message ID: whideferr

## Incorrect access of a member from const-qualified function

Example of code that generates the error message:

    class A {
        public:
    	int a;
    	void foo () const { a++; }
    }

Message ID: constaccess

## Invalid explicit instantiation declaration of class %1

Most likely the keyword 'class' is missing from the explicit instantiation declaration. Example of code that generates the error message:

    template  class X
    {
    };

    template X ;  // should be: template class X ;

Message ID: explclassinst

## should not initialize a non-const reference with a temporary

Should not initialize a non-const reference with a temporary Example of code that generates the warning message:

    struct C { C(int); };
    void add( C& c );
    void foo() { add( C(6) ); }

Message ID: reftotemp

## Expression must have a constant value

Template expression cannot be a non-const value. Example of code that generates the error message:

    template  void f();

    int main()
    {
        const int& ri = 12;
        f();	// error
    }

Message ID: tmplexpnotconst

## Function %1 can throw only the exceptions thrown by the function %2 it overrides

Function can throw only the exceptions allowed by the function it overrides Example of code that generates warning:

    struct A
    {
            virtual void foo() throw(A);
    };

    struct B : A
    {
            virtual void foo();
    };

Message ID: wlessrestrictedthrow

## Returning the address of an automatic variable

Returning a pointer to a local automatic variable. Example of code that generates this warning message:

    int* f() {
      int k=5;
      return &k;
    }

Message ID: autoaddrreturn

## parameter type involves pointer to array of unknown size

ptr to array of unknown size param Example of code that generates the error message:

    typedef int UNKA[];
    void f(UNKA *p);

Message ID: ptrarray0

## parameter type involves reference of array of unknown size

reference of array of unknown size param Example of code that generates the error message:

    typedef int UNKA[];
    void f(UNKA &p);

Message ID: refarray0

## Actual argument depends on template parameter(s) which cannot be deduced at point of use

Actual argument depends on template parameter(s) Example of code that generates the error message:

    void foo(...);
    template T count(T t);
    void bar() {
      foo(count);
    }

Message ID: dummyactualarg

## Identifier expected instead of

An identifier was expected. This can be used in situations where the construct is in error, but the compiler can effectively recover. Example of code that generates the error message:

    enum A {a, };

Message ID: identexpected

## have the same extern name

No two function defintion can have the same extern name Example of code that generates the error message:

    #pragma redefine_extname        fstat64 fstat

    extern "C"
    {
    int fstat(int fstat_int)
    {
            return (fstat_int+2);
    }
    int fstat64(long fstat64_long)
    {
            if (fstat64_long == 0)
                    return 0;
            return -1;
    }
    }  // error, fstat64 has the same extern name as fstat

Message ID: sameextname

## block local static variables not allowed with whole program optimization in compatibility mode

When compiling for whole program optimization (-xcrossfile or -xipo) in compatibility mode, static variables nested within inner scopes are not allowed.

For example in

    int f(int i)
    {
    	if (i != 0) {
    		static int sv = 2;
    		return sv + i;
    	}
    	return 0;
    }

sv will trigger this error.

Message ID: nocrossstatic

## Static data member definition uses the derived class

static data member definition uses the derived class Example of code that generates the warning:

    struct BASE { static int static_data; };
    struct DERIVED : public BASE { };
    int DERIVED::static_data;

Message ID: staticmemsearch

## Unable to parse field declaration in class template: skipping field

A field declaration cannot be parsed in the representative instantiation of a template class prehaps due to name lookup problems. This template class is rendered invalid.

For example:

    template < class T  >
    struct base
    {
      typedef T b_type ;
    } ;

    template < class T >
     struct derived : public base < T* >
    {
      typedef base < T* > Base ;
      const b_type foo ( const T & t ) const { }
    } ;

The member function foo cannot be parsed because b_type cannot be looked up as a type when parsing the representative instantiation for class derived.

Message ID: skipfield

## Exception specification is not allowed in typedef

No exception specification allowed in a typedef declaration

For example:

    typedef void (*pf) () throw();

Message ID: badexceptionspec

## Function pointer can only throw exceptions thrown by the function pointer assigned

Function pointer can only throw the exceptions thrown by the function pointer it is assigned to Example of code that generates warning:

    void (*pf1)();
    void (*pf2)() throw(int);
    void f() {
        pf2 = pf1;
    }

Message ID: fptrthrow

## only a single nowait, if, ordered, default or schedule clause may appear on a pragma

Example of code that generates the message: int NE_C2_3() { int a = 1;

    #pragma omp parallel if ( a > 1 ) if ( a < 5 )
        {
        }

        return 0;
    }

Message ID: omp_extraclause

## return, goto, break or continue statement not allowed in an openmp structured block

OpenMP parallel and worksharing constructs are require to be followed by structured block. A structured block is a statement that has a single entry and a single exit. No statement that causes a jump into or out of the block is allowed. A structured block cannot contain a return, goto, break or continue statement that causes control to flow out of the block. Example of code that generates the message:

    int NE_C2_4_1_1()
    {
    int i;
    #pragma omp for
        for (i = 0 ; i < 10 ; i++ )
        {
    	break ;
        }
        return 0;
    }

Message ID: omp_structblkviolation

## index variable of omp for loop must be a signed integer

Index variable of OpenMP for must have a signed integer type Example of code that generates the message:

    int NE_C2_4_1_3()
    {
    unsigned int i;
    #pragma omp for
        for (i = 0 ; i < 10 ; i++ )
        {
        }
        return 0;
    }

Message ID: omp_forbadindxtype

## A section directive must not appear outside the lexical extent of the sections directive

"section" OpenMP pragma must appear immediately inside a "sections" block. Example of code that generates the message:

    int NE_C2_4_2_1()
    {
    #pragma omp sections
        {
    	;
        }
    #pragma omp section
        {
        }
        return 0;
    }

Message ID: omp_sectionoutsidesections

## A variable specified in a flush directive must not have a reference type

Example of code that generates the message:

    int NE_C2_6_5_1()
    {
        int i = 5;
        int & n = i;
    #pragma omp parallel
        {
    #pragma omp flush (n)
        }
        return 0;
    }

Message ID: omp_varhasreftype

## ordered directive used within the lexical extent of non-ordered for

OpenMP directive ordered must not be in the dynamic extent of a for directive that does not have ordered clause specified. Example of code that generates the message:

    int NE_C2_6_6_1()
    {
    int i;
    #pragma omp for
        for (i=0; i<10 ; i++)
        {
    #pragma omp ordered
    	{
    	}
        }
        return 0;
    }

Message ID: omp_nonorderedfor

## threadprivate directive must appear at file scope

A threadprivate directive must appear at file scope or namespace scope, must appear outside of any definition or declaration. Example of code that generates the message:

    int a=0;

    class A
    {
    #pragma omp threadprivate ( a )
    };

    int NE_C2_7_1_1b()
    {
        return a;
    }

Message ID: omp_nonfilethreadprivate

## threadprivate directive must precede all references to variable

Threadprivate directive must lexically precede all references to any of the variables in its list. Example of code that generates the message:

    int a = 1;

    void foo()
    {
        a--;
    }

    #pragma omp threadprivate ( a )

    int NE_C2_7_1_1c()
    {
        return a;
    }

Message ID: omp_threadprivateprecederef

## A variable must not have a reference type

A threadprivate variable must not have a reference type. Example of code that generates the message:

    int a;
    int & b = a;

    #pragma omp threadprivate (b)

    int NE_C2_7_1_6a()
    {
        return 0;
    }

Message ID: omp_varinprivateref

## A variable must not have an incomplete type

Example of code that generates the message:

    class A;

    int foo(A & a)
    {
    #pragma omp parallel private (a)
        {
        }
        return 0;
    }

    int NE_C2_7_2_1_3()
    {
        return 0;
    }

Message ID: omp_varinprivateincomplete

## a threadprivate variable is not permitted in this clause

A threadprivate variable must not appear in any clause other than the copyin, schedule, or the if clause. As a result, they are not permitted in private, firstprivate, lastprivate, shared, or reduction clauses. They are not affected by the default clause. Example of code that generates the message:

    int a;

    #pragma omp threadprivate( a )

    int NE_C2_7_1_4a()
    {
    #pragma omp parallel private (a)
        {
        }
        return 0;
    }

Message ID: omp_threadprivatewrongclause

## A variable specified in a clause must not have a const-qualified type

Unless it has a class type with a mutable member, a variable specified in a private clause must not have a const-qualified type. Example of code that generates the message:

    class A
    {
    public:
        A();
    };

    int NE_C2_7_2_1_2()
    {
        const A a;
    #pragma omp parallel private(a)
        {
        }

        return 0;
    }

Message ID: omp_varmustnotbeconstqual

## variable must be explicitly listed in a data attribute clause of enclosing omp pragma

Example of code that generates the message:

    int NE_C2_7_2_5_2()
    {
        int a;
    #pragma omp parallel default (none)
        {
    	a=1;
        }
        return 0;
    }

Message ID: omp_defaultviolated

## type of reduction variable is invalid

Type of the variable specified in reduction clause must be valid for the reduction operator except that pointer types are never permitted. Example of code that generates the message:

    class A
    {
    };

    int NE_C2_7_2_6_1a()
    {
        A a;
    #pragma omp parallel reduction(+:a)
        {
        }
        return 0;
    }

Message ID: omp_reductionbadtype

## reduction variable must not have a const-qualified type

Variable specified in reduction clause must not have a const-qualified type. Example of code that generates the message:

    int NE_C2_7_2_6_2()
    {
        const int a = 0;
    #pragma omp parallel reduction (+: a)
        {
        }
        return 0;
    }

Message ID: omp_constreduction

## variable must not be specified in more than one clause

No variable may be specified in more than one clause, except that a variable can be specified in both a firstprivate and a lastprivate clause. Example of code that generates the message:

    int NE_C2_7_2_6_4()
    {
        int a = 0;
    #pragma omp parallel  shared (a) reduction (+: a)
        {
        }

        return 0;
    }

Message ID: omp_dupclause

## copyin variable is not threadprivate

A variable that is specified in copyin clause must be a threadprivate variable. Example of code that generates the message:

    int x;

    int NE_C2_7_2_7_2()
    {
    #pragma omp parallel copyin (x)
        {
        }
        return 0;
    }

Message ID: omp_copyinnotthreadprivate

## critical directives with the same name are not allowed to be nested inside each other

Critical directives with the same name are not allowed to be nested inside each other. Example of code that generates the message:

    int NE_C2_9_3_1()
    {
    #pragma omp critical
        {
    #pragma omp critical
    	{
    	}
        }
        return 0;
    }

Message ID: omp_badnestingcritical

## directive is not permitted in the dynamic extent of region

for, sections, and single directives are not permitted in the dynamic extent of critical, ordered, and master regions. Example of code that generates the message:

    int NE_C2_9_4_4()
    {
    #pragma omp master
        {
    #pragma omp for
    	for ( int i=0 ; i < 10 ; i++ )
    	{
    	}
        }
        return 0;
    }

Message ID: omp_badnestingregion

## for, sections, and single directives that bind to the same parallel are not allowed to be nested inside each other

for, sections, and single directives that bind to the same parallel are not allowed to be nested inside each other. Example of code that generates the message:

    int NE_C2_9_2_1()
    {
    #pragma omp parallel
        { int i;
    #pragma omp for
    	for (i=0 ; i < 10 ; i++)
    	{
    #pragma omp sections
    	    {
    		;
    	    }
    	}
        }

        return 0;
    }

Message ID: omp_badnestingparallel

## The smallest statement that contains a flush directive must be a block

The smallest statement that contains a flush directive must be a block (or compound-statement). Example of code that generates the message:

    int NE_C2_6_5_2()
    {
        int i = 5;
    #pragma omp parallel
        {
    	if ( i > 0 )
    #pragma omp barrier
        }
        return 0;
    }

Message ID: omp_mustbeblock

## When schedule(runtime) is specified, chunk_size must not be specified

When schedule(runtime) is specified, chunk_size must not be specified. Example of code that generates the message:

    int NE_C2_4_1_9()
    {
        int i;
    #pragma omp for schedule(runtime, 2)
        for (i=1;i<10;i++)
        {
        }
        return 0;
    }

Message ID: omp_chunksizemustnotbespecifiedomp-chunksizemustnotbespecified

## clause is not permitted in directive

Example of code that generates the message:

    int main(void)
    {
    #pragma omp for default(none)
        for (int i = 0 ; i < 10 ; i++ )
        {
        }
        return 0;
    }

Message ID: omp_badclause

## Skipping the rest of the current pragma up to the new line

Skip the rest of the current pragma up to the new line. It is used to separate OpenMP related error recovery from the C++ specific error recovery. Example of code that generates the message:

    int main(void)
    {
    #pragma omp for default(none)
        for (int i = 0 ; i < 10 ; i++ )
        {
        }
        return 0;
    }

Message ID: omp_skip

## Line directives must be positive

Line directives must specify positive integers. Example of code that generates the error message:

    #line 0 "file.cc"

Message ID: poslinenum

## variable is already specified as private in enclosing openmp pragma

Variables that are private (firstprivate/lastprivate) within a parallel region cannot be specified in a private (firstprivate/lastprivate) clause on an enclosed work-sharing or parallel directive. As a result, variables that are specified private on a work-sharing or parallel directive must be shared in the enclosing parallel region. Example of code that generates the message:

    int main()
    {
        int i,j;
        #pragma omp parallel private(j)
        {
    	#pragma omp for lastprivate(j)
    	for (i=0; i<10; i++)
    	    j++;
        }
        return 0;
    }

Message ID: omp_varalreadyprivate

## pragma is not allowed to be nested

Example of code that generates the message:

    int NE_C2_9_2_1()
    {
    #pragma omp parallel
        { int i;
    #pragma omp for
          for (i=0 ; i < 10 ; i++)
          {
    #pragma omp sections
              {
                  ;
              }
          }
        }

        return 0;
    }

Message ID: omp_badnesting

## reduction variable is not shared

A variable that is specified in reduction clause must be shared in the enclosing context. Example of code that generates the message:

    int main()
    {
      int i;
      #pragma omp parallel private(i)
    	#pragma omp sections reduction(+:i)
    	{
    	   i++;
    	}
      return 0;
    }

Message ID: omp_reductionnotshared

## badly formed OpenMP pragma

This message is displayed when general syntax error is discovered in OpenMP pragma. Example of code that generates the message:

    int main()
    {
      #pragma omp parallel private
      {
      }
      return 0;
    }

Message ID: omp_badlyformedomppragma

## control expression of omp for loop does not have a canonical shape

Control expression of OpenMP for must have canonical shape of the following form: Example of code that generates the message:

    int main()
    {
        int i,j=0;
        #pragma omp parallel for
        for (i=0; j<10; i++) {
        }
        return 0;
    }

Message ID: omp_forbadcontrol

## bad value for default clause

Only none or shared are valid values for default clause. Example of code that generates the message:

    int main()
    {
      int i;
      #pragma omp parallel default(private)
      {
    	i++;
      }
      return 0;
    }

Message ID: omp_baddefault

## invalid kind for schedule clause

The schedule clause kind must be one of - static, dynamic, guided, runtime. Example of code that generates the message:

    int main()
    {
      int i;
    #pragma omp parallel for schedule(normal,1)
      for (i=0;i<10;i++) {
      }
      return 0;
    }

Message ID: omp_badschedulekind

## invalid OpenMP pragma

Example of code that generates the message:

    int main()
    {
    #pragma omp unknown
        return 0;
    }

Message ID: omp_badomppragma

## return, goto, break or continue statement not allowed to enter or exit an openmp structured block

OpenMP parallel and worksharing constructs are require to be followed by structured block. A structured block is a statement that has a single entry and a single exit. No statement that causes a jump into or out of the block is allowed. A structured block cannot contain a return, goto, break or continue statement that causes control to flow out of the block. Example of code that generates the message:

    int foo() {
        #pragma omp parallel
        {
    	return 1;
        }
    }

Message ID: omp_strblkviolation

## iteration expression of omp for loop does not have a canonical shape

Iteration expression of OpenMP for must have a canonical shape. Example of code that generates the message:

    int main() {
        int i;
        #pragma omp parallel for
        for (i=0; i<10; foo(&i)) {
        }
        return 0;
    }

Message ID: omp_forbaditer

## init expression of omp for loop does not have a canonical shape

Init expression of OpenMP for must have canonical shape of the following form: = or = Example of code that generates the message:

    int main() {
        int i=0;
        #pragma omp parallel for
        for (; i<10; i++) {
        }
        return 0;
    }

Message ID: omp_forbadinit

## a for statement must follow an OpenMP for pragma

A for statement must follow an OpenMP for pragma. Example of code that generates the message:

    int main() {
        int i=0;
        #pragma omp parallel for
        {
        while( 0 ){
    	i++;
        }
        return 0;
    }

Message ID: omp_forbadfollow

## Declaration of \"%1\" is a function, not an object

Declaration of \"%1\" is syntactically ambiguous, but the standard interprets it as a function declaration. However, programmers often intend an object declaration. To avoid confusion, rewrite the declaration in a syntactically unambiguous manner. Example of code that generates the warning message:

    struct T { };
    T t( T() ); // t is a function

Suggested alternatives that are syntactically unambiguous:

    T t( (T()) ); // t is an object (types cannot have extra parens)
    T t = T(); // t is an object (assignment-style initialization)
    T t( T(*)() ); // t is a function (explicit function pointer)

Message ID: ambigfuncdecl

## bad chunksize expression in schedule clause

A chunksize must be an integral loop invariant positive non-zero value. Example of code that generates the error message:

    #pragma omp for schedule (static, 0)

Message ID: badchunksize

## loop indices within parallel region must be private variables

Loop indices within parallel regions must be private to the region. Example of code that generates the message:

    int main() {
         int i=0;
         #pragma omp parallel for shared(i)
             for(i=0; i<4; i++){
             }
         return 0;
         }

Message ID: omp_sharedforindex

## A class appears as an empty virtual base class

A class used in this file contains a virtual base class which has no non-static data members. Under certain circumstances this can result in virtual function calls going to the wrong function.

Message ID: warn_empty_virt_base

## A reference return value should be an lvalue (if the value of this function is used, the result is unpredictable)

A reference return value should be an lvalue. The standard allows a function returning a reference to a rvalue to be written. However, if the value is actually used, the result is unpredictable.

Message ID: nonvarrefww

## Attempt to call a pure virtual function will always fail

An attempt to call a pure virtual function from an object in which the function has not been overridden will always fail. A base-class pure virtual function will never be called via the virtual call mechanism. You must explicitly qualify the call, and you must provide a body for the function in a separate function definition. Example:

    struct T {
        virtual int f() = 0;
        T() { f(); }         // warning, pure virtual function called
        ~T() { T::f(); }     // OK, virtual call mechanism bypassed
        void g() { f(); }    // OK if g() called from derived-class object
    };
    int T::f() { return 0; } // definition of pure virtual function

Message ID: pure_virtual_w

## pragma critical is not allowed to be nested inside of critical with the same name

Critical directives with the same name are not allowed to be nested inside each other. Example of code that generates the message.

    void main(void) {
        #pragma omp critical(foo)
            #pragma omp critical(foo)
            ;
    }

Message ID: omp_badcriticalnesting

## A method was previously not declared native

A Java method that is declared native must be implemented with a C++ function. It is an error to supply a C++ verion of the method if it is not previously declared as a native method in the .class file.

Message ID: notjavanative

## A non-POD object passed as a variable argument to a function

The result of passing a non-POD object as a variable argument is undefined.

A POD (Plain Old Data) object is one that has no user-declared constructors, no user-defined destructor, no user-defined copy assignment operator, no base classes, no virtual functions, no private or protected non-static data members, and no non-static data members of type pointer-to-member, non-POD-struct, non-POD-union or reference.

    void foo(int, ...);
    struct T {
        T();
        ~T();
    };

    extern T t;

    int main()
    {
        foo(1, t); // Warning
    }

Message ID: nonpodvarargw

## A friend declaration must specify a class or function

The friend declaration did not have a class or function specified. Example of code that generates the error message:

    namespace N {
    	template  struct B { };
    }
    struct A {
      friend struct N::B; //should be an error here, B is a template, not a struct
    };

Message ID: wnofriendfield

## A friend declaration may have to add <> to syntax

Friend declaration declares a non-template function. Example of code that generates the warning:

    template < class T > bool foo (T);
    template < class T1 > class BC_base_identifier {
            friend bool foo(T1);
    };
    int main()
    {
            BC_base_identifier bi;
            foo(100);
    }

Message ID: nontmplfriend

## Incorrect argument passed in call to #pragma dumpmacros

valid arguments to #pragma dumpmacros are: defs, undefs, loc, conds, sys Example of code that generates the error message:

    #pragma dumpmacros(definitions)

Message ID: prbadarg

## Template nesting depth does not

Template nesting depth refers to specialization of a function template, only a non-template function is available. Example of code that generates the error message:

    template struct A {
        void f(int);
    };

    template<> template <> void A::f(int) {} // extra spec

Message ID: mismatchtmpdepth

## Conversion of 64-bit type value

Assignment, initialization or cast may truncate data when porting to 64bit. Example of code that generates the error message:

    long l;
    (int)l;

Message ID: truncwarn1

## Sign extension from

sign of data may be extended before being assigned to unsigned long when porting to 64bit. Example of code that generates the error message:

    int i;
    unsigned long ul = i;

Message ID: signextwarn

## 64-bit type bitfield may change

long or unsigned long bitfield declaration may change bitfield packing when porting to 64bit. Example of code that generates the error message:

    struct S {
            unsigned long b1:20;
            long b2:20;

    };

Message ID: bitfield64

## Keyword is being defined

a keyword is being defined. Example of code that generates the warning:

    #define bool unsigned int

Message ID: nokeyworddefine

## Ambiguous type conversion

2nd and third operands can be converted to each other

    struct S {
        S (int);
        operator int () const;
    };

    int main (int i)
    {
        S s0(0);
        i ? s0 : 1; // ambiguous type conversions
    }

Message ID: questambigerr

## block-scope variable specified in threadprivate directive must be static

A block-scope variable specified in threadprivate directive must be static. Example of code that generates the message:

    int main() {
        #pragma omp parallel
        {
            int i;
            #pragma omp threadprivate(i)
            i = 50;
        }
    }

Message ID: omp_threadprivatenotstatic

## threadprivate directive must appear in the scope of variable

A threadprivate directive for static block-scope variables must appear in the scope of the variable and not in a nested scope. Example of code that generates the message:

    int main() {
        static int i;
        #pragma omp parallel
        {
            #pragma omp threadprivate(i)
            i = 50;
        }
    }

Message ID: omp_threadprivateinnested

## if clause expression does not have scalar type

Expression specified in if clause of OpenMP parallel must have scalar type. Example of code that generates the message:

    int main() {
        struct { float val; } good = {3.62};

        #pragma omp parallel if(good)
          good.val = 4.12;
    }

Message ID: omp_badiftype

## num_threads clause expression does not have integer type

Expression specified in num_threads clause of OpenMP parallel must have integer type. Example of code that generates the message:

    int main() {
        int i = 0;

        #pragma omp parallel num_threads(3.62)
            i++;
    }

Message ID: omp_badnumthreadstype

## Complete class definition is not allowed in template argument declaration

A class definition cannot be specified in a template argument declaration. Example of code that generates the error message:

    template  class S{};

Message ID: noclassdef

## The copyprivate clause must not be used with the nowait clause

The copyprivate clause must not be used with the nowait clause. Example of code that generates the message:

    int main() {
        int i = 42;
        #pragma omp single nowait copyprivate(i)
        {
          i++;
        }
    }

Message ID: omp_badusecopyprivate

## variable specified in a copyprivate clause must be private in an enclosing context

If a single directive with a copyprivate clause is encountered in the dynamic extent of a parallel region, all variables specified in the copyprivate clause must be private in the enclosing context. Example of code that generates the message:

    int main() {
        int i = 1;
        #pragma omp parallel
        {
        i = 42;
          #pragma omp single copyprivate(i)
          {
                i++;
          }
        }
    }

Message ID: omp_notprivateincontext

## const qualifier must have declarator and initializer

const variables must be declared with declarator and intializer Example of code that generates the message:

    const enum E1 {a, b};		// Error
    const enum E2 {c, d} x = c;	// Okay

Message ID: badconstdecl

## volatile qualifier must have declarator

volatile variables must be declared with declarator Example of code that generates the message:

    volatile enum E1 {a, b};		// Error
    volatile enum E2 {c, d} x;		// Okay

Message ID: badvoldecl

## storage class specifier must have declarator

init-declarator-list required with storage class specifier Example of code that generates the message:

    register enum E4 { a4, b4 };	// Error
    register enum E5 { a5, b5 } e;  // Okay

Message ID: badstgdecl

## declarator required in declaration

init-declarator-list is required in this type of declaration Example of code that generates the message:

    typedef struct T { int i; };
    typedef enum F { f1, f2 };

Message ID: declreq

## storage class is not allowed in a friend declaration

Example of code that generates the error message:

    struct A {
            friend static void foo(A arg);
    };

Message ID: storefrienderr

## Comparing different enum types

Example of code that generates the warning message:

    #include

    int main()
    {
            enum Shape { shape1=2, shape2};
            enum Point { point1=4, point2};

            Shape cylinder = shape1;
            Point uper = point2;
            if ( cylinder == uper ) // Warning
                    cout << "Comparing different enum types" << endl;
    }

Message ID: diffenumtype

## [Hint: An object compiled with -xarch=v8plus must be linked with -xarch=v8plus]

Message ID: demxarchv8plus

## Infinite recursion when generating default argument expression

Example of code that message struct S { int f1(int = f2()); int f2(int = f1()); };

Message ID: recurseindefault

## The keywords \"virtual\" and \"friend\" cannot appear in the same declaration

A virtual function cannot be declared as a friend function. Example of code that generates the error message:

    void foo() { return; }
    void goo() { return; }

    class A {
            virtual friend void foo();    // ERROR
            virtual friend void A::goo(); // ERROR
    };

Message ID: virtfriendfunction

## Function \"%1\" has been declared \"friend\", using incomplete function declaration syntax

A Friend function has been declared using function name only. Example of code that generates the error message:

    namespace N {
      void foo(char);
      void foo();
    };

    class A {
      friend N::foo;
    };

Message ID: friendfunc

## Assigning a negative value to an implicit unsigned bitfield

Example of code that generates the warning message:

    struct No_constructor {
            int i : 30;
    };

    class Has_constructor {
            int j : 30;
    public:
            Has_constructor():j(-2){}       // line 8: Warning
    };

    int main() {
            struct No_constructor b = {1-2};// line 12: Warning
            b.i = -1.8;                     // line 13: Warning
    }

Message ID: negbitfield

## The name of an object or function cannot be a template-id

Example of code that generates the warning message:

    namespace N {
        template struct ap {
            ap(X* p = 0);
        };
    };
    using namespace N;
    class A { };
    A* a;
    ap ap(a) ;

Message ID: baddeclare

## Using a class object in an OpenMP private, firstprivate, or lastprivate data clause requires that the class have a default constructor.

Example of code that generate the warning message:

    class A {

    };
    main()
    {
        A a(10);
        #pragma omp parallel private(a)
        {
            ;
        }
    }

Message ID: nodefctor

## Ambiguous syntax that might have been intended to declare an explict template specialization or to create an explicit specialization has no effect. Other compilers might interpret the code differently.

Example of code that generates the warning:

    template  class A { ... };
    class A; // warning: ignored
    template<> class A; // declare explicit specialization
    template   class A; // explicit instantiation directive

Message ID: oldspecialdecl

## Functions are not data, and may not have the __thread specifier.

Example of code that generates the warning:

    __thread void func();
    struct type {
        __thread void func();
    };

Message ID: nothreadfuncs

## The first declaration of a __thread variable must say so.

Example of code that generates the warning:

    int changed;
    __thread int changed;

Message ID: threaddeclfirst

## Dynamic initializers are not suppored with __thread variables.

Dynamic initializers are not suppored with __thread variables. Dynamic initializers may arise from non-trivial constructors, destructors, base classes, or non-constant initializer expressions. Example of code that generates the warning:

    struct nontrivial_constructor {
        nontrivial_constructor();
    };
    __thread nontrivial_constructor unsupported1;
    struct nontrivial_destructor {
        nontrivial_destructor();
    };
    __thread nontrivial_destructor unsupported2;
    struct nontrivial_base : nontrivial_constructor {
    };
    __thread nontrivial_base unsupported3;
    extern int func();
    __thread int unsupported4 = func();

Message ID: threaddyninit

## Automatic variables may not be __thread variables.

Example of code that generates the warning:

    void func() {
        __thread int a;
    }

Message ID: noautothread

## Typename can not be used inside a template's explicit specialization

Example of code that generates the warning:

    template struct traits {
        typedef T ty;
    };

    template struct tn {
        typedef typename traits::ty tn_ty;
    };

    template <> struct tn {
        typedef typename traits::ty tn_ty;
    };

Message ID: explctspectypename

## An attempt was made to access private members in a class.

Example of code that generates the warning:

    class A {
            private:
                    int a;
    } ;
    struct B: A {
            private:
            A::a;	// Warning for standard mode
    } ;

Message ID: inaccessible_anach

## private variable cannot be specified in the clause

Variables that are private withing a parallel region cannot be specified in the reduction clause on a work-sharing directive that binds to the parallel construct. Example of code that generates the message:

    int main() {
        int i;
        #pragma omp parallel private(i)
        #pragma omp sections reduction(+:i)
        {
            i++;
        }
    }

Message ID: omp_cant_be_in_private

## reduction variable cannot be specified in the clause

Variables that appear in the reduction clause of a parallel directive cannot be specified in the reduction clause on a work-sharing directive that binds to the parallel construct. Example of code that generates the message:

    int main() {
        int i;
        #pragma omp parallel reduction(+:i)
        #pragma omp sections reduction(+:i)
        {
    	i++;
        }
    }

Message ID: omp_cant_be_in_reduction

## A variable specified in a clause must not have a const-qualified type

Unless it has a class type with a mutable member, a variable specified in a private clause must not have a const-qualified type. Example of code that generates the message:

    class A
    {
    public:
        A();
    };

    int NE_C2_7_2_1_2()
    {
        const A a;
    #pragma omp parallel private(a)
        {
        }

        return 0;
    }

Message ID: omp_varmustnotbeconst_qual

## Each OpenMP section must be a structured block

If a section contains more than one statement, they must be placed in {} Example of code that generates the message:

    #pragma omp sections
    {
    // optional #pragma omp section
      x = 5;
      y = 10;
    }

Message ID: omp_badsectionstructure

## A friend function template-id name should refer to a template declaration

The friend function name did not have a template declared in the nearest namespace or has it in the current class. Example of code that generates the error message:

    #include
    namespace M {
      template < class T > void i(T);
      class A {
        template < class T > void i(T);
        friend void i< > ( int );       //ill-formed - A::i
      };
      template< typename T >
      class Bar
      {
        std::valarray< T > fVA ;
        friend std::valarray< T > const
        Fu< >( Bar< T > const & ) ;     // Fu<> has no declaration in a namespace M
      } ;
    };

Message ID: wnotempdecl

## External linkage is not available for inline functions

External linkage is not available for inline functions. Example of code that generates the message:

    int f();
    inline int f() { return 0; }

Message ID: wbadlinkage_w

## Only extern symbols may have linker scoping.

Example of code that generates the warning:

    static __symbolic int variable;
    static __hidden int function() {
         __global int stackvar;
    }

Message ID: ldscopeonlyextern

## Linker scopes may only be more restrictive

Linker scopes may only be more restrictive on subsequent declarations. Linker scope __hidden is more restrictive than __symbolic, which is more restrictive than __global, which is more restrictive than unspecified linker scope. Example of code that generates the warning:

    __hidden int function();
    __symbolic int function();

Message ID: ldscoperestrict

## Linker scopes may not change after symbol definition.

Example of code that generates the warning:

    __symbolic int function() { }
    __hidden int function();

Message ID: ldscopechanged

## Conversion of \"%1\" value to \"%2\" causes truncation

Example of code that generates the warning:

    char c[100000];
    short i = sizeof(c);

Message ID: truncwarn2

## A class with a reference member must have a user-defined constructor

A class with a reference member must have a user-defined constructor Example of code that generates the error message:

    struct S {
        int x&;
    };

    Message ID: refmemnoconstr

## The pch file being used does not have the correct magic number

The pch file being used does not have the correct magic number

Message ID: pchbadmagicnumber

## The pch file being used has an incorrect format string in the front matter

The pch file being used has an incorrect format string in the front matter

Message ID: pchbadformatstr

## The pch collect and use mode compiler release strings are incompatible

The pch collect and use mode compiler release strings are incompatible

Message ID: pchbadreleasestr

## The pch file was expected to contain defines

The pch file was expected to contain defines

Message ID: pchexpdefines

## The pch file was expected to contain undefs

The pch file was expected to contain undefs

Message ID: pchexpundefs

## The list of defines in the pch collect and use modes is not the same

The list of defines in the pch collect and use modes is not the same

Message ID: pchbaddefines

## The list of undefs in the pch collect and use modes is not the same

The list of undefs in the pch collect and use modes is not the same

Message ID: pchbadundefs

## The viable prefix in the pch collect and use modes is not the same

The viable prefix in the pch collect and use modes is not the same PRE>

Message ID: pchbadviableprefix

## Invalid template nesting depth

Invalid template nesting depth Example of code that generates the error message:

    template <class X> template <class Y>
    void foo();	// ERROR: invalid template nesting depth

    struct S {
        template <class X> template <class Y>
        void foo();	// ERROR: invalid template nesting depth
    }

Message ID: badnesttmpl

## shared loop control variable was made private

Variables that are used for loop control in parallel for are implicitly declared private, as a result shared() clause has no effect on such variables. Example of code that generates the message:

    int main() {
        int i,j;
        #pragma omp parallel for shared(i,j)
        for (i=0; i<10; i++) j = i;
    	;
        return 0;
    }

Message ID: omp_shared_control_var

## Static non-POD decl not allowed in parallel region

Static non-POD decl not allowed in parallel region Example of code that generates the error message:

    class A {public: int i; A(){i = 10;};};
    #pragma omp parallel
    {
        static A a;
        ;
    }

Message ID: omp_staticclassdecl

## U string literals may only contain ASCII

Example of code that generates the warning:

    unsigned short bar[] = U"é";

Message ID: ustronlyascii

## U string literals may not contain numeric escapes

Example of code that generates the warning:

    unsigned short bar[] = U"\351";

Message ID: ustrnoescape

## Possibly missing or badly placed #pragma hdrstop or -xpchstop point

Possibly missing or badly placed #pragma hdrstop or -xpchstop point

Message ID: pchbadstoppoint

## Only comments and certain preprocessor directives allowed in viable prefix

Only comments and certain preprocessor directives allowed in viable prefix

Message ID: pchbadviablepref

## Too many open files

Too many open files, maybe a file including itself

Message ID: toomanyopenfiles

## Cannot cast away const or volatile

There was an attempt to cast away const or volatile. Examples of code that generates the error message:

    class B { virtual void foo(); };

    class A: public B {};

    const B * pb = new A;
    A *pa1 = dynamic_cast<A*>(pb); // ERROR: dynamic_cast casts const pb to a non-const pointer.

    extern int *const** p1;
    int **const* p2 = reinterpret_cast<int **const*>(p1); // ERROR

    extern volatile int *pi;
    int *pi2 = static_cast<int*>(pi); // ERROR

Message ID: castawayconst

## threadprivate directive may not appear in definition or declaration

A threadprivate directive must appear outside of any definition or declaration. Example of code that generates the message:

    class A
    {
      int a;
      #pragma omp threadprivate ( a )
    };

Message ID: omp_badthreadprivate

## An explicit template argument list is not allowed in a primary template declaration

An explicit template argument list is not allowed in a primary template declaration Example of code that generates the message:

    template  void bar ();
    template  void bar ();

Message ID: wexpltemplid

## An atomic pragma must be followed by an expression

An atomic pragma must be followed by a single expression statement. Example of code that generates the message:

    #pragma omp atomic
    {               // '{' not allowed
    i++;
    }

Message ID: omp_badatomicfollow

## has been called before being declared inline

Function has been used before it's declaration as inline. This means that all preceding calls will be processed as extern. Subsequent calls will be inlined. Example of code that generates the error message:

    class A {
        public:
            void foo ();
    };

    int main () {
        A a;
        a.foo();
    }

    inline
    void A::foo () {}

Message ID: inlafteruse

## template declaration may not be followed by an explicit specialization declaration

Cannot specialize an inner template without also specializing the outer template Example of code that generates the error message:

    template  struct S {
        template  struct I;
        template  void foo();
    };

    template  template <> struct S::I; // ERROR
    template  template <> void S::foo(); // ERROR

Message ID: nestexplspec

## explicit specialization is not allowed in the current scope

Explicit specialization can be declared in namespace scope only Example of code that generates the error message:

    struct S {
        template  struct I;
        template  void foo();

        template <> struct I; // ERROR
        template <> void foo(); // ERROR
    };

Message ID: badexplspec

## explicit specialization must be declared in namespace containing template

Explicit specialization of a template must be declared in the same namespace as template Example of code that generates the error message:

    namespace N {
        template  struct S {};
        template  void foo();
    }
    template <> struct N::S; // Warning
    template <> void N::foo(); // Warning

Message ID: badexplspecdecl

## explicit specialization may not be defined in the current scope

Explicit specialization may be defined in a namespace containing declaration or enclosing namespace with declaration Example of code that generates the error message:

    namespace N {
        template  struct S {};
        template  void foo();

        template <> struct S;
        template <> void foo();
    }
    namespace M {
        template <> struct N::S {}; // Warning
        template <> void N::foo() {} // Warning
    }

Message ID: badexplspecdef