Skip to content

clang doesn't diagnose some invalid code #14747

Open
@llvmbot

Description

@llvmbot
Bugzilla Link 14375
Version trunk
OS All
Reporter LLVM Bugzilla Contributor
CC @DougGregor,@zygoloid

Extended Description

http://gcc.gnu.org/ml/gcc/2012-11/msg00210.html and followups: GCC produces an error with diagnostic for the invalid code snippets posted below, while clang 3.0 and ToT (tested with r168286) don't, even with e.g. -Weverything.

According to the followups, compilers are not required to produce diagnostics for that situation, but it would nevertheless be nice for users to have them :)
The followups mention 3.3.6/1 and [dcl.typedef]/6.

===== begin snippet 1 (original testcase) =====
class A {};
class B : public A {

typedef A super;

public:

class X {};

};

class C : public B {

typedef B super;

class X : public super::X {

   typedef super::X super;
};

};
===== end snippet 1 =====

===== begin snippet 2 (reduced testcase in first followup) =====
typedef struct { typedef int type; } s1;
struct S2 { s1::type s1; };
===== end snippet 2 =====

Metadata

Metadata

Assignees

No one assigned

    Labels

    accepts-invalidbugzillaIssues migrated from bugzillac++clang:frontendLanguage frontend issues, e.g. anything involving "Sema"confirmedVerified by a second party

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions