2012-04-18 06:30:01 +08:00
|
|
|
// RUN: %clang_cc1 -std=c++11 -emit-llvm %s -o - -verify -fexceptions -fcxx-exceptions -triple x86_64-linux-gnu | FileCheck %s
|
Implement DR1330 in C++11 mode, to support libstdc++4.7 which uses it.
We have a new flavor of exception specification, EST_Uninstantiated. A function
type with this exception specification carries a pointer to a FunctionDecl, and
the exception specification for that FunctionDecl is instantiated (if needed)
and used in the place of the function type's exception specification.
When a function template declaration with a non-trivial exception specification
is instantiated, the specialization's exception specification is set to this
new 'uninstantiated' kind rather than being instantiated immediately.
Expr::CanThrow has migrated onto Sema, so it can instantiate exception specs
on-demand. Also, any odr-use of a function triggers the instantiation of its
exception specification (the exception specification could be needed by IRGen).
In passing, fix two places where a DeclRefExpr was created but the corresponding
function was not actually marked odr-used. We used to get away with this, but
don't any more.
Also fix a bug where instantiating an exception specification which refers to
function parameters resulted in a crash. We still have the same bug in default
arguments, which I'll be looking into next.
This, plus a tiny patch to fix libstdc++'s common_type, is enough for clang to
parse (and, in very limited testing, support) all of libstdc++4.7's standard
headers.
llvm-svn: 154886
2012-04-17 08:58:00 +08:00
|
|
|
|
2012-04-18 06:30:01 +08:00
|
|
|
void h();
|
|
|
|
|
|
|
|
template<typename T> void f() noexcept(sizeof(T) == 4) { h(); }
|
2012-04-19 08:08:28 +08:00
|
|
|
template<typename T> void g() noexcept(sizeof(T) == 4);
|
2012-04-18 06:30:01 +08:00
|
|
|
|
|
|
|
template<typename T> struct S {
|
|
|
|
static void f() noexcept(sizeof(T) == 4) { h(); }
|
2012-04-19 08:08:28 +08:00
|
|
|
static void g() noexcept(sizeof(T) == 4);
|
2012-04-18 06:30:01 +08:00
|
|
|
};
|
|
|
|
|
2013-02-16 05:30:01 +08:00
|
|
|
// CHECK: define {{.*}} @_Z1fIsEvv() "target-features"={{.*}} {
|
2012-04-18 06:30:01 +08:00
|
|
|
template<> void f<short>() { h(); }
|
2013-02-16 05:30:01 +08:00
|
|
|
// CHECK: define {{.*}} @_Z1fIA2_sEvv() nounwind "target-features"={{.*}} {
|
2012-04-18 06:30:01 +08:00
|
|
|
template<> void f<short[2]>() noexcept { h(); }
|
|
|
|
|
|
|
|
// CHECK: define {{.*}} @_ZN1SIsE1fEv()
|
|
|
|
// CHECK-NOT: nounwind
|
|
|
|
template<> void S<short>::f() { h(); }
|
|
|
|
// CHECK: define {{.*}} @_ZN1SIA2_sE1fEv() nounwind
|
|
|
|
template<> void S<short[2]>::f() noexcept { h(); }
|
|
|
|
|
2013-02-16 05:30:01 +08:00
|
|
|
// CHECK: define {{.*}} @_Z1fIDsEvv() "target-features"={{.*}} {
|
2012-04-18 06:30:01 +08:00
|
|
|
template void f<char16_t>();
|
2013-02-16 05:30:01 +08:00
|
|
|
// CHECK: define {{.*}} @_Z1fIA2_DsEvv() nounwind "target-features"={{.*}} {
|
2012-04-18 06:30:01 +08:00
|
|
|
template void f<char16_t[2]>();
|
|
|
|
|
|
|
|
// CHECK: define {{.*}} @_ZN1SIDsE1fEv()
|
|
|
|
// CHECK-NOT: nounwind
|
|
|
|
template void S<char16_t>::f();
|
|
|
|
// CHECK: define {{.*}} @_ZN1SIA2_DsE1fEv() nounwind
|
|
|
|
template void S<char16_t[2]>::f();
|
Implement DR1330 in C++11 mode, to support libstdc++4.7 which uses it.
We have a new flavor of exception specification, EST_Uninstantiated. A function
type with this exception specification carries a pointer to a FunctionDecl, and
the exception specification for that FunctionDecl is instantiated (if needed)
and used in the place of the function type's exception specification.
When a function template declaration with a non-trivial exception specification
is instantiated, the specialization's exception specification is set to this
new 'uninstantiated' kind rather than being instantiated immediately.
Expr::CanThrow has migrated onto Sema, so it can instantiate exception specs
on-demand. Also, any odr-use of a function triggers the instantiation of its
exception specification (the exception specification could be needed by IRGen).
In passing, fix two places where a DeclRefExpr was created but the corresponding
function was not actually marked odr-used. We used to get away with this, but
don't any more.
Also fix a bug where instantiating an exception specification which refers to
function parameters resulted in a crash. We still have the same bug in default
arguments, which I'll be looking into next.
This, plus a tiny patch to fix libstdc++'s common_type, is enough for clang to
parse (and, in very limited testing, support) all of libstdc++4.7's standard
headers.
llvm-svn: 154886
2012-04-17 08:58:00 +08:00
|
|
|
|
2012-04-19 08:08:28 +08:00
|
|
|
void h() {
|
2013-02-16 05:30:01 +08:00
|
|
|
// CHECK: define {{.*}} @_Z1fIiEvv() nounwind "target-features"={{.*}} {
|
Implement DR1330 in C++11 mode, to support libstdc++4.7 which uses it.
We have a new flavor of exception specification, EST_Uninstantiated. A function
type with this exception specification carries a pointer to a FunctionDecl, and
the exception specification for that FunctionDecl is instantiated (if needed)
and used in the place of the function type's exception specification.
When a function template declaration with a non-trivial exception specification
is instantiated, the specialization's exception specification is set to this
new 'uninstantiated' kind rather than being instantiated immediately.
Expr::CanThrow has migrated onto Sema, so it can instantiate exception specs
on-demand. Also, any odr-use of a function triggers the instantiation of its
exception specification (the exception specification could be needed by IRGen).
In passing, fix two places where a DeclRefExpr was created but the corresponding
function was not actually marked odr-used. We used to get away with this, but
don't any more.
Also fix a bug where instantiating an exception specification which refers to
function parameters resulted in a crash. We still have the same bug in default
arguments, which I'll be looking into next.
This, plus a tiny patch to fix libstdc++'s common_type, is enough for clang to
parse (and, in very limited testing, support) all of libstdc++4.7's standard
headers.
llvm-svn: 154886
2012-04-17 08:58:00 +08:00
|
|
|
f<int>();
|
2013-02-16 05:30:01 +08:00
|
|
|
// CHECK: define {{.*}} @_Z1fIA2_iEvv() "target-features"={{.*}} {
|
Implement DR1330 in C++11 mode, to support libstdc++4.7 which uses it.
We have a new flavor of exception specification, EST_Uninstantiated. A function
type with this exception specification carries a pointer to a FunctionDecl, and
the exception specification for that FunctionDecl is instantiated (if needed)
and used in the place of the function type's exception specification.
When a function template declaration with a non-trivial exception specification
is instantiated, the specialization's exception specification is set to this
new 'uninstantiated' kind rather than being instantiated immediately.
Expr::CanThrow has migrated onto Sema, so it can instantiate exception specs
on-demand. Also, any odr-use of a function triggers the instantiation of its
exception specification (the exception specification could be needed by IRGen).
In passing, fix two places where a DeclRefExpr was created but the corresponding
function was not actually marked odr-used. We used to get away with this, but
don't any more.
Also fix a bug where instantiating an exception specification which refers to
function parameters resulted in a crash. We still have the same bug in default
arguments, which I'll be looking into next.
This, plus a tiny patch to fix libstdc++'s common_type, is enough for clang to
parse (and, in very limited testing, support) all of libstdc++4.7's standard
headers.
llvm-svn: 154886
2012-04-17 08:58:00 +08:00
|
|
|
f<int[2]>();
|
2012-04-18 06:30:01 +08:00
|
|
|
|
|
|
|
// CHECK: define {{.*}} @_ZN1SIiE1fEv() nounwind
|
|
|
|
S<int>::f();
|
|
|
|
// CHECK: define {{.*}} @_ZN1SIA2_iE1fEv()
|
|
|
|
// CHECK-NOT: nounwind
|
|
|
|
S<int[2]>::f();
|
|
|
|
|
2013-02-16 05:30:01 +08:00
|
|
|
// CHECK: define {{.*}} @_Z1fIfEvv() nounwind "target-features"={{.*}} {
|
Implement DR1330 in C++11 mode, to support libstdc++4.7 which uses it.
We have a new flavor of exception specification, EST_Uninstantiated. A function
type with this exception specification carries a pointer to a FunctionDecl, and
the exception specification for that FunctionDecl is instantiated (if needed)
and used in the place of the function type's exception specification.
When a function template declaration with a non-trivial exception specification
is instantiated, the specialization's exception specification is set to this
new 'uninstantiated' kind rather than being instantiated immediately.
Expr::CanThrow has migrated onto Sema, so it can instantiate exception specs
on-demand. Also, any odr-use of a function triggers the instantiation of its
exception specification (the exception specification could be needed by IRGen).
In passing, fix two places where a DeclRefExpr was created but the corresponding
function was not actually marked odr-used. We used to get away with this, but
don't any more.
Also fix a bug where instantiating an exception specification which refers to
function parameters resulted in a crash. We still have the same bug in default
arguments, which I'll be looking into next.
This, plus a tiny patch to fix libstdc++'s common_type, is enough for clang to
parse (and, in very limited testing, support) all of libstdc++4.7's standard
headers.
llvm-svn: 154886
2012-04-17 08:58:00 +08:00
|
|
|
void (*f1)() = &f<float>;
|
2013-02-16 05:30:01 +08:00
|
|
|
// CHECK: define {{.*}} @_Z1fIdEvv() "target-features"={{.*}} {
|
Implement DR1330 in C++11 mode, to support libstdc++4.7 which uses it.
We have a new flavor of exception specification, EST_Uninstantiated. A function
type with this exception specification carries a pointer to a FunctionDecl, and
the exception specification for that FunctionDecl is instantiated (if needed)
and used in the place of the function type's exception specification.
When a function template declaration with a non-trivial exception specification
is instantiated, the specialization's exception specification is set to this
new 'uninstantiated' kind rather than being instantiated immediately.
Expr::CanThrow has migrated onto Sema, so it can instantiate exception specs
on-demand. Also, any odr-use of a function triggers the instantiation of its
exception specification (the exception specification could be needed by IRGen).
In passing, fix two places where a DeclRefExpr was created but the corresponding
function was not actually marked odr-used. We used to get away with this, but
don't any more.
Also fix a bug where instantiating an exception specification which refers to
function parameters resulted in a crash. We still have the same bug in default
arguments, which I'll be looking into next.
This, plus a tiny patch to fix libstdc++'s common_type, is enough for clang to
parse (and, in very limited testing, support) all of libstdc++4.7's standard
headers.
llvm-svn: 154886
2012-04-17 08:58:00 +08:00
|
|
|
void (*f2)() = &f<double>;
|
2012-04-18 06:30:01 +08:00
|
|
|
|
|
|
|
// CHECK: define {{.*}} @_ZN1SIfE1fEv() nounwind
|
|
|
|
void (*f3)() = &S<float>::f;
|
|
|
|
// CHECK: define {{.*}} @_ZN1SIdE1fEv()
|
|
|
|
// CHECK-NOT: nounwind
|
|
|
|
void (*f4)() = &S<double>::f;
|
|
|
|
|
2013-02-16 05:30:01 +08:00
|
|
|
// CHECK: define {{.*}} @_Z1fIA4_cEvv() nounwind "target-features"={{.*}} {
|
Implement DR1330 in C++11 mode, to support libstdc++4.7 which uses it.
We have a new flavor of exception specification, EST_Uninstantiated. A function
type with this exception specification carries a pointer to a FunctionDecl, and
the exception specification for that FunctionDecl is instantiated (if needed)
and used in the place of the function type's exception specification.
When a function template declaration with a non-trivial exception specification
is instantiated, the specialization's exception specification is set to this
new 'uninstantiated' kind rather than being instantiated immediately.
Expr::CanThrow has migrated onto Sema, so it can instantiate exception specs
on-demand. Also, any odr-use of a function triggers the instantiation of its
exception specification (the exception specification could be needed by IRGen).
In passing, fix two places where a DeclRefExpr was created but the corresponding
function was not actually marked odr-used. We used to get away with this, but
don't any more.
Also fix a bug where instantiating an exception specification which refers to
function parameters resulted in a crash. We still have the same bug in default
arguments, which I'll be looking into next.
This, plus a tiny patch to fix libstdc++'s common_type, is enough for clang to
parse (and, in very limited testing, support) all of libstdc++4.7's standard
headers.
llvm-svn: 154886
2012-04-17 08:58:00 +08:00
|
|
|
(void)&f<char[4]>;
|
2013-02-16 05:30:01 +08:00
|
|
|
// CHECK: define {{.*}} @_Z1fIcEvv() "target-features"={{.*}} {
|
Implement DR1330 in C++11 mode, to support libstdc++4.7 which uses it.
We have a new flavor of exception specification, EST_Uninstantiated. A function
type with this exception specification carries a pointer to a FunctionDecl, and
the exception specification for that FunctionDecl is instantiated (if needed)
and used in the place of the function type's exception specification.
When a function template declaration with a non-trivial exception specification
is instantiated, the specialization's exception specification is set to this
new 'uninstantiated' kind rather than being instantiated immediately.
Expr::CanThrow has migrated onto Sema, so it can instantiate exception specs
on-demand. Also, any odr-use of a function triggers the instantiation of its
exception specification (the exception specification could be needed by IRGen).
In passing, fix two places where a DeclRefExpr was created but the corresponding
function was not actually marked odr-used. We used to get away with this, but
don't any more.
Also fix a bug where instantiating an exception specification which refers to
function parameters resulted in a crash. We still have the same bug in default
arguments, which I'll be looking into next.
This, plus a tiny patch to fix libstdc++'s common_type, is enough for clang to
parse (and, in very limited testing, support) all of libstdc++4.7's standard
headers.
llvm-svn: 154886
2012-04-17 08:58:00 +08:00
|
|
|
(void)&f<char>;
|
2012-04-18 06:30:01 +08:00
|
|
|
|
|
|
|
// CHECK: define {{.*}} @_ZN1SIA4_cE1fEv() nounwind
|
|
|
|
(void)&S<char[4]>::f;
|
|
|
|
// CHECK: define {{.*}} @_ZN1SIcE1fEv()
|
|
|
|
// CHECK-NOT: nounwind
|
|
|
|
(void)&S<char>::f;
|
Implement DR1330 in C++11 mode, to support libstdc++4.7 which uses it.
We have a new flavor of exception specification, EST_Uninstantiated. A function
type with this exception specification carries a pointer to a FunctionDecl, and
the exception specification for that FunctionDecl is instantiated (if needed)
and used in the place of the function type's exception specification.
When a function template declaration with a non-trivial exception specification
is instantiated, the specialization's exception specification is set to this
new 'uninstantiated' kind rather than being instantiated immediately.
Expr::CanThrow has migrated onto Sema, so it can instantiate exception specs
on-demand. Also, any odr-use of a function triggers the instantiation of its
exception specification (the exception specification could be needed by IRGen).
In passing, fix two places where a DeclRefExpr was created but the corresponding
function was not actually marked odr-used. We used to get away with this, but
don't any more.
Also fix a bug where instantiating an exception specification which refers to
function parameters resulted in a crash. We still have the same bug in default
arguments, which I'll be looking into next.
This, plus a tiny patch to fix libstdc++'s common_type, is enough for clang to
parse (and, in very limited testing, support) all of libstdc++4.7's standard
headers.
llvm-svn: 154886
2012-04-17 08:58:00 +08:00
|
|
|
}
|
2012-04-19 08:08:28 +08:00
|
|
|
|
|
|
|
// CHECK: define {{.*}} @_Z1iv
|
|
|
|
void i() {
|
|
|
|
// CHECK: declare {{.*}} @_Z1gIiEvv() nounwind
|
|
|
|
g<int>();
|
|
|
|
// CHECK: declare {{.*}} @_Z1gIA2_iEvv()
|
|
|
|
// CHECK-NOT: nounwind
|
|
|
|
g<int[2]>();
|
|
|
|
|
|
|
|
// CHECK: declare {{.*}} @_ZN1SIiE1gEv() nounwind
|
|
|
|
S<int>::g();
|
|
|
|
// CHECK: declare {{.*}} @_ZN1SIA2_iE1gEv()
|
|
|
|
// CHECK-NOT: nounwind
|
|
|
|
S<int[2]>::g();
|
|
|
|
|
|
|
|
// CHECK: declare {{.*}} @_Z1gIfEvv() nounwind
|
|
|
|
void (*g1)() = &g<float>;
|
|
|
|
// CHECK: declare {{.*}} @_Z1gIdEvv()
|
|
|
|
// CHECK-NOT: nounwind
|
|
|
|
void (*g2)() = &g<double>;
|
|
|
|
|
|
|
|
// CHECK: declare {{.*}} @_ZN1SIfE1gEv() nounwind
|
|
|
|
void (*g3)() = &S<float>::g;
|
|
|
|
// CHECK: declare {{.*}} @_ZN1SIdE1gEv()
|
|
|
|
// CHECK-NOT: nounwind
|
|
|
|
void (*g4)() = &S<double>::g;
|
|
|
|
|
|
|
|
// CHECK: declare {{.*}} @_Z1gIA4_cEvv() nounwind
|
|
|
|
(void)&g<char[4]>;
|
|
|
|
// CHECK: declare {{.*}} @_Z1gIcEvv()
|
|
|
|
// CHECK-NOT: nounwind
|
|
|
|
(void)&g<char>;
|
|
|
|
|
|
|
|
// CHECK: declare {{.*}} @_ZN1SIA4_cE1gEv() nounwind
|
|
|
|
(void)&S<char[4]>::g;
|
|
|
|
// CHECK: declare {{.*}} @_ZN1SIcE1gEv()
|
|
|
|
// CHECK-NOT: nounwind
|
|
|
|
(void)&S<char>::g;
|
|
|
|
}
|
|
|
|
|
|
|
|
template<typename T> struct Nested {
|
|
|
|
template<bool b, typename U> void f() noexcept(sizeof(T) == sizeof(U));
|
|
|
|
};
|
|
|
|
|
|
|
|
// CHECK: define {{.*}} @_Z1jv
|
|
|
|
void j() {
|
|
|
|
// CHECK: declare {{.*}} @_ZN6NestedIiE1fILb1EcEEvv(
|
|
|
|
// CHECK-NOT: nounwind
|
|
|
|
Nested<int>().f<true, char>();
|
|
|
|
// CHECK: declare {{.*}} @_ZN6NestedIlE1fILb0ElEEvv({{.*}}) nounwind
|
|
|
|
Nested<long>().f<false, long>();
|
|
|
|
}
|