[LLVMbugs] [Bug 16828] New: [accepts-invalid] Dereferencing pointer to incomplete enclosing class

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Aug 7 13:38:57 PDT 2013


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

            Bug ID: 16828
           Summary: [accepts-invalid] Dereferencing pointer to incomplete
                    enclosing class
           Product: clang
           Version: unspecified
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++11
          Assignee: unassignedclangbugs at nondot.org
          Reporter: zeratul976 at hotmail.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Clang accepts the following code:


struct S
{
    int foo();

    struct nested
    {
        S* outer;

        auto bar() -> decltype(outer->foo());
    };
};


GCC rejects it, with the following errors:

test.cpp:9:37: error: invalid use of incomplete type ‘struct S’
test.cpp:1:8: error: forward declaration of ‘struct S’

The reason for rejecting it is stated in [1]. If that reasoning is sound, then
clang should reject the code as well. If it's not, I'd be curious to hear why.

[1] http://gcc.gnu.org/ml/gcc-patches/2013-08/msg00398.html

-- 
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/20130807/60ff9807/attachment.html>


More information about the llvm-bugs mailing list