================
@@ -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.
----------------
Endilll wrote:

Corentin is correct: neither wording in CWG317, nor the modern wording justify 
the approach you're taking.

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