[LLVMbugs] [Bug 17588] Forward Declaration of classes Within Namespaces causes error

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Oct 15 06:16:33 PDT 2013


http://llvm.org/bugs/show_bug.cgi?id=17588

jonathan.sauer at gmx.de changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |jonathan.sauer at gmx.de
         Resolution|---                         |INVALID

--- Comment #1 from jonathan.sauer at gmx.de ---
The forward declaration is invalid, as you cannot declare namespace elements
from outside the namespace. See C++ Standard §7.3.1.2p2 (emphasis mine):

| Members of a named namespace can also be defined outside that namespace by
| explicit qualification (3.4.3.2) of the name being defined, *provided that
the
| entity being defined was already declared in the namespace and the definition
| appears after the point of declaration in a namespace that encloses the
| declaration’s namespace*.

You have to say:

namespace MyNamespace {
  class MyClass;
}


The fact that the code used to compile with clang means that this was a bug in
clang that was fixed in the meantime.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20131015/250260da/attachment.html>


More information about the llvm-bugs mailing list