[LLVMbugs] [Bug 13690] New: elaborated type refers to a typedef

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Aug 24 08:25:05 PDT 2012


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

             Bug #: 13690
           Summary: elaborated type refers to a typedef
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: vanyacpp at gmail.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified


Clang accepts the following code:

struct a
{
    struct x
    {};
};

struct b : a
{
    typedef int x;
};

struct c : b
{
    void f()
    {
        struct x y;
    }
};

I believe there should be an error "elaborated type refers to a typedef".

According to C++ standard:

[basic.lookup.elab]p2:

If the elaborated-type-specifier has a nested-name-specifier, qualified name
lookup is performed, as described in 3.4.3, but ignoring any non-type names
that have been declared.

[dcl.type.elab]p2:

If the identifier resolves to a typedef-name or the simple-template-id resolves
to an alias template specialization, the elaborated-type-specifier is
ill-formed.

Note, that clang (correctly) rejects the following code:

struct x {};

namespace a
{
    typedef int x;

    void f()
    {
        struct x y;
    }
}

error: elaborated type refers to a typedef

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list