File tree Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -2990,8 +2990,11 @@ void Sema::CheckConstructor(CXXConstructorDecl *Constructor) {
2990
2990
QualType ClassTy = Context.getTagDeclType (ClassDecl);
2991
2991
if (Context.getCanonicalType (ParamType).getUnqualifiedType () == ClassTy) {
2992
2992
SourceLocation ParamLoc = Constructor->getParamDecl (0 )->getLocation ();
2993
+ const char *ConstRef
2994
+ = Constructor->getParamDecl (0 )->getIdentifier () ? " const &"
2995
+ : " const &" ;
2993
2996
Diag (ParamLoc, diag::err_constructor_byvalue_arg)
2994
- << FixItHint::CreateInsertion (ParamLoc, " const & " );
2997
+ << FixItHint::CreateInsertion (ParamLoc, ConstRef );
2995
2998
2996
2999
// FIXME: Rather that making the constructor invalid, we should endeavor
2997
3000
// to fix the type.
You can’t perform that action at this time.
0 commit comments