Skip to content

Make use of copy constructors called statically but not dynamically an error #8047

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 13, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions include/swift/AST/TypeRepr.h
Original file line number Diff line number Diff line change
Expand Up @@ -283,8 +283,12 @@ class SimpleIdentTypeRepr : public ComponentIdentTypeRepr {
SimpleIdentTypeRepr(SourceLoc Loc, Identifier Id)
: ComponentIdentTypeRepr(TypeReprKind::SimpleIdent, Loc, Id) {}

// SmallVector::emplace_back will never need to call this because
// we reserve the right size, but it does try statically.
SimpleIdentTypeRepr(const SimpleIdentTypeRepr &repr)
: SimpleIdentTypeRepr(repr.getLoc(), repr.getIdentifier()) {}
: SimpleIdentTypeRepr(repr.getLoc(), repr.getIdentifier()) {
llvm_unreachable("should not be called dynamically");
}

static bool classof(const TypeRepr *T) {
return T->getKind() == TypeReprKind::SimpleIdent;
Expand Down Expand Up @@ -849,8 +853,11 @@ class FixedTypeRepr : public TypeRepr {
FixedTypeRepr(Type Ty, SourceLoc Loc)
: TypeRepr(TypeReprKind::Fixed), Ty(Ty), Loc(Loc) {}

FixedTypeRepr(const FixedTypeRepr& repr)
: FixedTypeRepr(repr.Ty, repr.Loc) {}
// SmallVector::emplace_back will never need to call this because
// we reserve the right size, but it does try statically.
FixedTypeRepr(const FixedTypeRepr &repr) : FixedTypeRepr(repr.Ty, repr.Loc) {
llvm_unreachable("should not be called dynamically");
}

/// Retrieve the location.
SourceLoc getLoc() const { return Loc; }
Expand Down