Commit cc7ce44e by Giovanni Bajo

dr176.C: Add missing semicolon (typo).

	* g++.dg/tc1/dr176.C: Add missing semicolon (typo).
	* g++.dg/tc1/dr101.C, g++.dg/tc1/dr135.C, g++.dg/tc1/dr142.C,
	g++.dg/tc1/dr152.C, g++.dg/tc1/dr159.C,	g++.dg/tc1/dr161.C,
	g++.dg/tc1/dr166.C, g++.dg/tc1/dr176.C,	g++.dg/tc1/dr193.C,
	g++.dg/tc1/dr194.C, g++.dg/tc1/dr217.C,	g++.dg/tc1/dr56.C,
	g++.dg/tc1/dr68.C, g++.dg/tc1/dr76.C, g++.dg/tc1/dr80.C,
	g++.dg/tc1/dr94.C: Fix line terminator.

From-SVN: r77950
parent ef3f573f
2004-02-17 Giovanni Bajo <giovannibajo@gcc.gnu.org>
* g++.dg/tc1/dr176.C: Add missing semicolon (typo).
* g++.dg/tc1/dr101.C, g++.dg/tc1/dr135.C, g++.dg/tc1/dr142.C,
g++.dg/tc1/dr152.C, g++.dg/tc1/dr159.C, g++.dg/tc1/dr161.C,
g++.dg/tc1/dr166.C, g++.dg/tc1/dr176.C, g++.dg/tc1/dr193.C,
g++.dg/tc1/dr194.C, g++.dg/tc1/dr217.C, g++.dg/tc1/dr56.C,
g++.dg/tc1/dr68.C, g++.dg/tc1/dr76.C, g++.dg/tc1/dr80.C,
g++.dg/tc1/dr94.C: Fix line terminator.
2004-02-16 Geoffrey Keating <geoffk@apple.com> 2004-02-16 Geoffrey Keating <geoffk@apple.com>
* gcc.c-torture/compile/20040216-1.c: New. * gcc.c-torture/compile/20040216-1.c: New.
......
// { dg-do compile } // { dg-do compile }
// Origin: Giovanni Bajo <giovannibajo at gcc dot gnu dot org> // Origin: Giovanni Bajo <giovannibajo at gcc dot gnu dot org>
// DR101: Redeclaration of extern "C" names via using-declarations // DR101: Redeclaration of extern "C" names via using-declarations
namespace Test1 { namespace Test1 {
typedef unsigned int X; typedef unsigned int X;
extern "C" void f1(); extern "C" void f1();
namespace N { namespace N {
typedef unsigned int X; typedef unsigned int X;
extern "C" void f1(); extern "C" void f1();
} }
using N::f1; // { dg-bogus "" "redeclaration through 'using' should not be ambiguous" } using N::f1; // { dg-bogus "" "redeclaration through 'using' should not be ambiguous" }
using N::X; // { dg-bogus "" "redeclaration through 'using' should not be ambiguous" } using N::X; // { dg-bogus "" "redeclaration through 'using' should not be ambiguous" }
} }
namespace Test2 { namespace Test2 {
typedef unsigned int X; typedef unsigned int X;
extern "C" int f2(); extern "C" int f2();
namespace N { namespace N {
typedef unsigned int X; typedef unsigned int X;
extern "C" int f2(); extern "C" int f2();
} }
using namespace N; using namespace N;
int i = f2(); // { dg-bogus "" "redeclaration through 'using' should not be ambiguous" } int i = f2(); // { dg-bogus "" "redeclaration through 'using' should not be ambiguous" }
X x; // { dg-bogus "" "redeclaration through 'using' should not be ambiguous" { xfail *-*-* } } X x; // { dg-bogus "" "redeclaration through 'using' should not be ambiguous" { xfail *-*-* } }
} }
// { dg-do compile } // { dg-do compile }
// Origin: Giovanni Bajo <giovannibajo at gcc dot gnu dot org> // Origin: Giovanni Bajo <giovannibajo at gcc dot gnu dot org>
// DR135: Class type in in-class member function definitions // DR135: Class type in in-class member function definitions
struct S { struct S {
S f() { return S(); } // { dg-bogus "" "incomplete class type is allowed as return type" } S f() { return S(); } // { dg-bogus "" "incomplete class type is allowed as return type" }
void g(S) { } // { dg-bogus "" "incomplete class type is allowed as parameter type" } void g(S) { } // { dg-bogus "" "incomplete class type is allowed as parameter type" }
}; };
// { dg-do compile } // { dg-do compile }
// Origin: Giovanni Bajo <giovannibajo at gcc dot gnu dot org> // Origin: Giovanni Bajo <giovannibajo at gcc dot gnu dot org>
// DR142: Injection-related errors in access example // DR142: Injection-related errors in access example
class B { // { dg-error "inaccessible" } class B { // { dg-error "inaccessible" }
public: public:
int mi; // { dg-error "inaccessible" } int mi; // { dg-error "inaccessible" }
static int si; // { dg-error "inaccessible" } static int si; // { dg-error "inaccessible" }
}; };
class D: private B { class D: private B {
}; };
class DD: public D { class DD: public D {
void f(); void f();
}; };
void DD::f() { void DD::f() {
mi = 3; // { dg-error "within this context" "" } mi = 3; // { dg-error "within this context" "" }
si = 3; // { dg-error "within this context" "" } si = 3; // { dg-error "within this context" "" }
::B b; ::B b;
b.mi = 3; b.mi = 3;
b.si = 3; b.si = 3;
::B::si = 3; ::B::si = 3;
::B* bp1 = this; // { dg-error "inaccessible base" "" } ::B* bp1 = this; // { dg-error "inaccessible base" "" }
::B* bp2 = (::B*)this; ::B* bp2 = (::B*)this;
bp2->mi = 3; bp2->mi = 3;
B b2; // { dg-error "within this context" "" } B b2; // { dg-error "within this context" "" }
B::si = 3; // { dg-error "within this context" "" } B::si = 3; // { dg-error "within this context" "" }
} }
// { dg-do compile } // { dg-do compile }
// Origin: Giovanni Bajo <giovannibajo at gcc dot gnu dot org> // Origin: Giovanni Bajo <giovannibajo at gcc dot gnu dot org>
// DR152: explicit copy constructors // DR152: explicit copy constructors
namespace N1 { namespace N1 {
struct X { struct X {
X(); X();
explicit X(const X&); explicit X(const X&);
}; };
void f(X); void f(X);
int foo() int foo()
{ {
X x; X x;
f(x); // { dg-error "" "" } f(x); // { dg-error "" "" }
} }
} }
namespace N2 { namespace N2 {
template <class T> template <class T>
struct X { struct X {
X(); X();
explicit X(const X&); explicit X(const X&);
}; };
template <class T> template <class T>
void f(T ) {} void f(T ) {}
template <class T> template <class T>
int foo() int foo()
{ {
X<T> x; X<T> x;
N2::f(x); // { dg-error "" "" } N2::f(x); // { dg-error "" "" }
} }
template int foo<float>(); // { dg-error "instantiated from here" } template int foo<float>(); // { dg-error "instantiated from here" }
} }
// { dg-do compile } // { dg-do compile }
// Origin: Giovanni Bajo <giovannibajo at gcc dot gnu dot org> // Origin: Giovanni Bajo <giovannibajo at gcc dot gnu dot org>
// DR159: Namespace qualification in declarators // DR159: Namespace qualification in declarators
namespace N { namespace N {
namespace M { namespace M {
void f(); void f();
void g(); void g();
} }
void M::f(){} void M::f(){}
void N::M::g(){} void N::M::g(){}
} }
// { dg-do compile } // { dg-do compile }
// Origin: Giovanni Bajo <giovannibajo at gcc dot gnu dot org> // Origin: Giovanni Bajo <giovannibajo at gcc dot gnu dot org>
// DR161: Access to protected nested type // DR161: Access to protected nested type
namespace N1 { namespace N1 {
struct A struct A
{ {
protected: protected:
typedef int type; typedef int type;
}; };
struct B : public A struct B : public A
{ {
void test(void) void test(void)
{ {
A::type t; A::type t;
} }
friend void ftest(void) friend void ftest(void)
{ {
A::type t; A::type t;
} }
}; };
} }
namespace N2 { namespace N2 {
template <class T> template <class T>
struct A struct A
{ {
protected: protected:
typedef int type; typedef int type;
}; };
template <class T> template <class T>
struct B : public A<T> struct B : public A<T>
{ {
void test(B b) void test(B b)
{ {
typename A<T>::type t; typename A<T>::type t;
} }
friend void ftest(B b) friend void ftest(B b)
{ {
typename A<T>::type t; typename A<T>::type t;
} }
}; };
template struct B<void>; template struct B<void>;
} }
// { dg-do compile } // { dg-do compile }
// Origin: Giovanni Bajo <giovannibajo at gcc dot gnu dot org> // Origin: Giovanni Bajo <giovannibajo at gcc dot gnu dot org>
// DR166: Friend declarations of template-ids // DR166: Friend declarations of template-ids
namespace N { namespace N {
template <class T> void f(T); template <class T> void f(T);
void g(); void g();
namespace M { namespace M {
class A { class A {
friend void f<int>(int); // N::f friend void f<int>(int); // N::f
static int x; // { dg-error "private" } static int x; // { dg-error "private" }
}; };
class B { class B {
template <class T> friend void f(T); // M::f template <class T> friend void f(T); // M::f
static int x; // { dg-error "private" } static int x; // { dg-error "private" }
}; };
class C { class C {
friend void g(); // M::g friend void g(); // M::g
static int x; // { dg-error "private" } static int x; // { dg-error "private" }
}; };
template <class T> void f(T) // will be instantiated as f<long> template <class T> void f(T) // will be instantiated as f<long>
{ {
M::A::x = 0; // { dg-error "within this context" } M::A::x = 0; // { dg-error "within this context" }
M::B::x = 0; M::B::x = 0;
} }
template <> void f<int>(int) template <> void f<int>(int)
{ M::A::x = 0; } // { dg-error "within this context" } { M::A::x = 0; } // { dg-error "within this context" }
template <> void f<double>(double ) template <> void f<double>(double )
{ {
M::B::x = 0; M::B::x = 0;
M::f<long>(0); // { dg-error "instantiated" } M::f<long>(0); // { dg-error "instantiated" }
} }
void g(void) void g(void)
{ M::C::x = 0; } { M::C::x = 0; }
} }
template <class T> void f(T) // will be instantiated as f<long> template <class T> void f(T) // will be instantiated as f<long>
{ {
M::A::x = 0; // { dg-error "within this context" } M::A::x = 0; // { dg-error "within this context" }
M::B::x = 0; // { dg-error "within this context" } M::B::x = 0; // { dg-error "within this context" }
} }
template <> void f<int>(int ) template <> void f<int>(int )
{ {
N::f<long>(0); // { dg-error "instantiated" } N::f<long>(0); // { dg-error "instantiated" }
M::A::x = 0; M::A::x = 0;
M::B::x = 0; // { dg-error "within this context" } M::B::x = 0; // { dg-error "within this context" }
} }
template <> void f<char>(char ) template <> void f<char>(char )
{ M::A::x = 0; } // { dg-error "within this context" } { M::A::x = 0; } // { dg-error "within this context" }
void g(void) void g(void)
{ M::C::x = 0; } // { dg-error "within this context" } { M::C::x = 0; } // { dg-error "within this context" }
} }
// { dg-do compile } // { dg-do compile }
// Origin: Giovanni Bajo <giovannibajo at gcc dot gnu dot org> // Origin: Giovanni Bajo <giovannibajo at gcc dot gnu dot org>
// DR176: Name injection and templates // DR176: Name injection and templates
namespace N1 { namespace N1 {
template <class T> struct Base { template <class T> struct Base {
Base* p; Base* p;
Base<T*>* p2; Base<T*>* p2;
::Base* p3; // { dg-error "" "" } ::Base* p3; // { dg-error "" "" }
}; };
template <class T> struct Derived: public Base<T> { template <class T> struct Derived: public Base<T> {
Base* p; // { dg-bogus "" "injected class name in derived classes" { xfail *-*-* } } Base* p; // { dg-bogus "" "injected class name in derived classes" { xfail *-*-* } }
Base<T*>* p2; Base<T*>* p2;
typename Derived::Base* p3; // { dg-bogus "" "injected class name in derived classes" { xfail *-*-* } } typename Derived::Base* p3; // { dg-bogus "" "injected class name in derived classes" { xfail *-*-* } }
}; };
template struct Derived<void>; // { dg-bogus "instantiated from here" "everything should be looked up at parsing time (after DR224)" { xfail *-*-* } } template struct Derived<void>; // { dg-bogus "instantiated from here" "everything should be looked up at parsing time (after DR224)" { xfail *-*-* } }
} }
namespace N2 { namespace N2 {
template <class T> struct Base {}; template <class T> struct Base {};
template <class T> struct Derived: public Base<T> { template <class T> struct Derived: public Base<T> {
typename Derived::template Base<double>* p1; // { dg-bogus "" "" { xfail *-*-* } } typename Derived::template Base<double>* p1; // { dg-bogus "" "" { xfail *-*-* } }
} };
template struct Derived<void>; template struct Derived<void>;
} }
// { dg-do run } // { dg-do run }
// Origin: Giovanni Bajo <giovannibajo at gcc dot gnu dot org> // Origin: Giovanni Bajo <giovannibajo at gcc dot gnu dot org>
// DR193: Order of destruction of local automatics of destructor // DR193: Order of destruction of local automatics of destructor
extern "C" void abort(void); extern "C" void abort(void);
namespace N1 { namespace N1 {
bool a_done = false; bool a_done = false;
struct A struct A
{ {
~A() ~A()
{ {
a_done = true; a_done = true;
} }
}; };
struct B struct B
{ {
~B() ~B()
{ {
if (!a_done) if (!a_done)
abort(); abort();
} }
}; };
struct C { struct C {
B x; B x;
~C() { ~C() {
A y; A y;
}; };
}; };
} }
namespace N2 { namespace N2 {
bool a_done = false; bool a_done = false;
template <class> template <class>
struct A struct A
{ {
~A() ~A()
{ {
a_done = true; a_done = true;
} }
}; };
template <class> template <class>
struct B struct B
{ {
~B() ~B()
{ {
if (!a_done) if (!a_done)
abort(); abort();
} }
}; };
template <class T> template <class T>
struct C { struct C {
B<T> x; B<T> x;
~C() { ~C() {
A<T> y; A<T> y;
}; };
}; };
} }
int main(void) int main(void)
{ {
N1::C c1; N1::C c1;
N2::C<void> c2; N2::C<void> c2;
return 0; return 0;
} }
...@@ -3,14 +3,14 @@ ...@@ -3,14 +3,14 @@
// DR194: Identifying constructors // DR194: Identifying constructors
struct A struct A
{ {
inline explicit A(); inline explicit A();
}; };
template <class> template <class>
struct B struct B
{ {
inline explicit B(); inline explicit B();
}; };
template struct B<void>; template struct B<void>;
// { dg-do compile } // { dg-do compile }
// Origin: Giovanni Bajo <giovannibajo at gcc dot gnu dot org> // Origin: Giovanni Bajo <giovannibajo at gcc dot gnu dot org>
// DR217: Default arguments for non-template member functions of class // DR217: Default arguments for non-template member functions of class
// templates // templates
template <class T> template <class T>
struct S struct S
{ {
void foo (int); void foo (int);
}; };
template <class T> template <class T>
void S<T>::foo (int = 0) // { dg-error "" "default arguments for parameters of member functions of class templates can be specified in the initial declaration only" { xfail *-*-* } } void S<T>::foo (int = 0) // { dg-error "" "default arguments for parameters of member functions of class templates can be specified in the initial declaration only" { xfail *-*-* } }
{ } { }
// { dg-do link } // { dg-do link }
// Origin: Giovanni Bajo <giovannibajo at gcc dot gnu dot org> // Origin: Giovanni Bajo <giovannibajo at gcc dot gnu dot org>
// DR48: Definitions of unused static members // DR48: Definitions of unused static members
struct A { struct A {
static const int size = 10; static const int size = 10;
int array[size]; int array[size];
}; };
int main() { int main() {
A a; A a;
return 0; return 0;
} }
// { dg-do compile } // { dg-do compile }
// Origin: Giovanni Bajo <giovannibajo at gcc dot gnu dot org> // Origin: Giovanni Bajo <giovannibajo at gcc dot gnu dot org>
// DR56: Redeclaring typedefs within classes // DR56: Redeclaring typedefs within classes
class X { class X {
typedef int I; typedef int I;
typedef int I; // { dg-error "" "Cannot redeclare a typedef in a class scope" { xfail *-*-* } } typedef int I; // { dg-error "" "Cannot redeclare a typedef in a class scope" { xfail *-*-* } }
}; };
// In non-class scope, they are allowed. // In non-class scope, they are allowed.
typedef int A; typedef int A;
typedef int A; typedef int A;
// { dg-do compile } // { dg-do compile }
// Origin: Giovanni Bajo <giovannibajo at gcc dot gnu dot org> // Origin: Giovanni Bajo <giovannibajo at gcc dot gnu dot org>
// DR68: Grammar does not allow "friend class A<int>;" // DR68: Grammar does not allow "friend class A<int>;"
namespace A{ namespace A{
class B{}; class B{};
} }
namespace B{ namespace B{
class A{}; class A{};
class C{ class C{
friend class ::A::B; friend class ::A::B;
}; };
} }
template <typename> class K; template <typename> class K;
class J { class J {
friend class K<int>; friend class K<int>;
}; };
// { dg-do compile } // { dg-do compile }
// Origin: Giovanni Bajo <giovannibajo at gcc dot gnu dot org> // Origin: Giovanni Bajo <giovannibajo at gcc dot gnu dot org>
// DR76: Are const volatile variables considered "constant expressions"? // DR76: Are const volatile variables considered "constant expressions"?
volatile const int a = 5; volatile const int a = 5;
template <int> struct K; template <int> struct K;
template struct K<a>; // { dg-error "non-constant" } template struct K<a>; // { dg-error "non-constant" }
// { dg-do compile } // { dg-do compile }
// Origin: Giovanni Bajo <giovannibajo at gcc dot gnu dot org> // Origin: Giovanni Bajo <giovannibajo at gcc dot gnu dot org>
// DR80: Class members with same name as class // DR80: Class members with same name as class
struct A struct A
{ {
int A; int A;
}; };
struct A2 struct A2
{ {
static int A2; // { dg-error "same name as" } static int A2; // { dg-error "same name as" }
}; };
template <class> template <class>
struct A3 struct A3
{ {
int A3; int A3;
}; };
template <class> template <class>
struct A4 struct A4
{ {
static int A4; // { dg-error "same name as" } static int A4; // { dg-error "same name as" }
}; };
struct B struct B
{ {
B(); B();
int B; // { dg-error "same name as" } int B; // { dg-error "same name as" }
}; };
struct B2 struct B2
{ {
B2(); B2();
static int B2; // { dg-error "same name as" } static int B2; // { dg-error "same name as" }
}; };
template <class> template <class>
struct B3 struct B3
{ {
B3(); B3();
int B3; // { dg-error "same name as" "this error should appear at parsing time" { xfail *-*-* } } int B3; // { dg-error "same name as" "this error should appear at parsing time" { xfail *-*-* } }
}; };
template <class> template <class>
struct B4 struct B4
{ {
B4(); B4();
static int B4; // { dg-error "same name as" } static int B4; // { dg-error "same name as" }
}; };
// { dg-do compile } // { dg-do compile }
// Origin: Giovanni Bajo <giovannibajo at gcc dot gnu dot org> // Origin: Giovanni Bajo <giovannibajo at gcc dot gnu dot org>
// DR94: Inconsistencies in the descriptions of constant expressions // DR94: Inconsistencies in the descriptions of constant expressions
struct S { struct S {
static const int c = 5; static const int c = 5;
}; };
int a[S::c]; int a[S::c];
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment