@@ -3922,18 +3922,6 @@ bool Sema::MergeFunctionDecl(FunctionDecl *New, NamedDecl *&OldD, Scope *S,
3922
3922
}
3923
3923
3924
3924
if (getLangOpts().CPlusPlus) {
3925
- // C++1z [over.load]p2
3926
- // Certain function declarations cannot be overloaded:
3927
- // -- Function declarations that differ only in the return type,
3928
- // the exception specification, or both cannot be overloaded.
3929
-
3930
- // Check the exception specifications match. This may recompute the type of
3931
- // both Old and New if it resolved exception specifications, so grab the
3932
- // types again after this. Because this updates the type, we do this before
3933
- // any of the other checks below, which may update the "de facto" NewQType
3934
- // but do not necessarily update the type of New.
3935
- if (CheckEquivalentExceptionSpec(Old, New))
3936
- return true;
3937
3925
OldQType = Context.getCanonicalType(Old->getType());
3938
3926
NewQType = Context.getCanonicalType(New->getType());
3939
3927
@@ -4055,6 +4043,19 @@ bool Sema::MergeFunctionDecl(FunctionDecl *New, NamedDecl *&OldD, Scope *S,
4055
4043
}
4056
4044
}
4057
4045
4046
+ // C++1z [over.load]p2
4047
+ // Certain function declarations cannot be overloaded:
4048
+ // -- Function declarations that differ only in the return type,
4049
+ // the exception specification, or both cannot be overloaded.
4050
+
4051
+ // Check the exception specifications match. This may recompute the type of
4052
+ // both Old and New if it resolved exception specifications, so grab the
4053
+ // types again after this. Because this updates the type, we do this before
4054
+ // any of the other checks below, which may update the "de facto" NewQType
4055
+ // but do not necessarily update the type of New.
4056
+ if (CheckEquivalentExceptionSpec(Old, New))
4057
+ return true;
4058
+
4058
4059
// C++11 [dcl.attr.noreturn]p1:
4059
4060
// The first declaration of a function shall specify the noreturn
4060
4061
// attribute if any declaration of that function specifies the noreturn
0 commit comments