llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
28.05k stars 11.58k forks source link

clang++ incorrectly accepts "typename" in "using-declaration" without a nested-name-specifier #15734

Open llvmbot opened 11 years ago

llvmbot commented 11 years ago
Bugzilla Link 15362
Version 3.1
OS Windows NT
Reporter LLVM Bugzilla Contributor
CC @DougGregor

Extended Description

According to the C++11 standard, the production of the rule using-declaration is:

using typename[opt] nested-name-specifier unqualified-id ; using :: unqualified-id ;

But it seems that clang (3.1 at least) accepts also this syntax:

using typename :: unqualified-id ;

Which is not part of the standard.

The following little code illustrates this:

typedef int T;
namespace foo {
  int T;
  namespace bar {
    using typename ::T; // < this should be rejected because of the presence of 'typename'
    T a;
  }
}
AaronBallman commented 1 year ago

This issue happens as of Clang 16.0.0: https://godbolt.org/z/n79z1Kqvd

llvmbot commented 1 year ago

@llvm/issue-subscribers-c-11

zwuis commented 1 week ago

This code should be well-formed. See CWG1887.