mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-03-02 23:50:19 +00:00
When transforming a C++ "new" expression's constructor arguments, drop
any arguments that are default-argument expressions. The can show up when we have a new expression whose constructor arguments are not type-dependent and whose allocated type is not dependent and has a constructor with default arguments. Fixes PR7202. llvm-svn: 104690
This commit is contained in:
parent
870e5759e7
commit
1b30b3c9fa
@ -5210,6 +5210,9 @@ TreeTransform<Derived>::TransformCXXNewExpr(CXXNewExpr *E) {
|
||||
// transform the constructor arguments (if any).
|
||||
ASTOwningVector<&ActionBase::DeleteExpr> ConstructorArgs(SemaRef);
|
||||
for (unsigned I = 0, N = E->getNumConstructorArgs(); I != N; ++I) {
|
||||
if (getDerived().DropCallArgument(E->getConstructorArg(I)))
|
||||
break;
|
||||
|
||||
OwningExprResult Arg = getDerived().TransformExpr(E->getConstructorArg(I));
|
||||
if (Arg.isInvalid())
|
||||
return SemaRef.ExprError();
|
||||
|
@ -194,6 +194,37 @@ namespace N12 {
|
||||
void f0(int **a) { C::f0(a); }
|
||||
}
|
||||
|
||||
namespace PR7202 {
|
||||
template<typename U, typename T>
|
||||
struct meta {
|
||||
typedef T type;
|
||||
};
|
||||
|
||||
struct X {
|
||||
struct dummy;
|
||||
|
||||
template<typename T>
|
||||
X(T, typename meta<T, dummy*>::type = 0);
|
||||
|
||||
template<typename T, typename A>
|
||||
X(T, A);
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
struct Z { };
|
||||
|
||||
template<typename T> Z<T> g(T);
|
||||
|
||||
struct Y {
|
||||
template<typename T>
|
||||
void f(T t) {
|
||||
new X(g(*this));
|
||||
}
|
||||
};
|
||||
|
||||
template void Y::f(int);
|
||||
}
|
||||
|
||||
namespace N13 {
|
||||
class A{
|
||||
A(const A&);
|
||||
|
Loading…
x
Reference in New Issue
Block a user