llvm-project icon indicating copy to clipboard operation
llvm-project copied to clipboard

Clang can not compile typename with non-type in using declaration

Open haoxintu opened this issue 6 years ago • 2 comments

Bugzilla Link 46214
Resolution INVALID
Resolved on Jun 05, 2020 10:19
Version trunk
OS All
CC @DougGregor,@zygoloid

Extended Description

cat test.cc

namespace g_namespace { int var = 9; typedef int C; } int main() { using typename g_namespace::var; //fails using typename g_namespace::C; //ok return 0; }

$clang++-trunk test.cc :6:31: error: 'typename' keyword used on a non-type using typename g_namespace::var; //fails ^ :2:9: note: target of using declaration int var = 9; ^ 1 error generated. Execution build compiler returned: 1

Reproduced in godbolt: https://godbolt.org/z/MgR7GF

In GCC, test.cc is compiled well.

I am wondering that is it Clang still not support this feature that using-declaration with a non-type typename or this is a bug in clang?

haoxintu avatar Jun 05 '20 12:06 haoxintu

Specifically, this is https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65969

In GCC, test.cc is compiled well.

That's a GCC bug. The qualified name after 'typename' is required to name a type.