================
@@ -689,11 +689,24 @@ bool Sema::MergeCXXFunctionDecl(FunctionDecl *New, 
FunctionDecl *Old,
              (New->isInlineSpecified() ||
               New->getFriendObjectKind() == Decl::FOK_None)) {
     // C++11 [dcl.fcn.spec]p4:
-    //   If the definition of a function appears in a translation unit before 
its
-    //   first declaration as inline, the program is ill-formed.
-    Diag(New->getLocation(), diag::err_inline_decl_follows_def) << New;
-    Diag(Def->getLocation(), diag::note_previous_definition);
-    Invalid = true;
+    //   If the definition of a function appears in a translation unit before
+    //   its first declaration as inline, the program is ill-formed.
+    //
+    // Exception: a friend inline redeclaration of a function that takes the
+    // enclosing class as a parameter is valid. The class was incomplete at the
+    // point of the original definition, so it could not have been declared
+    // inline there.
----------------
arrowten wrote:

@cor3ntin I based this change from 
https://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#317. Correct me 
if I am wrong.

https://github.com/llvm/llvm-project/pull/199239
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to