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: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected]
    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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to