@@ -1783,11 +1783,24 @@ static bool interp__builtin_memcpy(InterpState &S, CodePtr OpPC,
1783
1783
if (DestPtr.isDummy () || SrcPtr.isDummy ())
1784
1784
return false ;
1785
1785
1786
+ if (DestPtr.getType ()->isIncompleteType ()) {
1787
+ S.FFDiag (S.Current ->getSource (OpPC),
1788
+ diag::note_constexpr_memcpy_incomplete_type)
1789
+ << Move << DestPtr.getType ();
1790
+ return false ;
1791
+ }
1792
+ if (SrcPtr.getType ()->isIncompleteType ()) {
1793
+ S.FFDiag (S.Current ->getSource (OpPC),
1794
+ diag::note_constexpr_memcpy_incomplete_type)
1795
+ << Move << SrcPtr.getType ();
1796
+ return false ;
1797
+ }
1798
+
1786
1799
QualType DestElemType = getElemType (DestPtr);
1787
1800
if (DestElemType->isIncompleteType ()) {
1788
1801
S.FFDiag (S.Current ->getSource (OpPC),
1789
- diag::note_constexpr_ltor_incomplete_type )
1790
- << DestElemType;
1802
+ diag::note_constexpr_memcpy_incomplete_type )
1803
+ << Move << DestElemType;
1791
1804
return false ;
1792
1805
}
1793
1806
@@ -1832,16 +1845,6 @@ static bool interp__builtin_memcpy(InterpState &S, CodePtr OpPC,
1832
1845
return false ;
1833
1846
}
1834
1847
1835
- if (DestElemType->isIncompleteType () ||
1836
- DestPtr.getType ()->isIncompleteType ()) {
1837
- QualType DiagType =
1838
- DestElemType->isIncompleteType () ? DestElemType : DestPtr.getType ();
1839
- S.FFDiag (S.Current ->getSource (OpPC),
1840
- diag::note_constexpr_memcpy_incomplete_type)
1841
- << Move << DiagType;
1842
- return false ;
1843
- }
1844
-
1845
1848
if (!DestElemType.isTriviallyCopyableType (ASTCtx)) {
1846
1849
S.FFDiag (S.Current ->getSource (OpPC), diag::note_constexpr_memcpy_nontrivial)
1847
1850
<< Move << DestElemType;
@@ -2030,8 +2033,13 @@ static bool interp__builtin_memchr(InterpState &S, CodePtr OpPC,
2030
2033
return true ;
2031
2034
}
2032
2035
2033
- if (Ptr.isDummy ())
2036
+ if (Ptr.isDummy ()) {
2037
+ if (Ptr.getType ()->isIncompleteType ())
2038
+ S.FFDiag (S.Current ->getSource (OpPC),
2039
+ diag::note_constexpr_ltor_incomplete_type)
2040
+ << Ptr.getType ();
2034
2041
return false ;
2042
+ }
2035
2043
2036
2044
// Null is only okay if the given size is 0.
2037
2045
if (Ptr.isZero ()) {
0 commit comments