llvm / llvm-project

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

templated constexpr constant in a template fails to deduce auto type #42804

Open 3a3ee7bd-941c-4a35-8f11-f0c2bc84adbe opened 5 years ago

3a3ee7bd-941c-4a35-8f11-f0c2bc84adbe commented 5 years ago
Bugzilla Link 43459
Version trunk
OS All
CC @invexed,@zygoloid

Extended Description

The following code compiled on clang 8 and is now wrong in clang 9.

See: https://godbolt.org/z/WdLl4c

template struct Template { template static constexpr auto type_v = 0; };

using T = Template; static_assert(T::type_v == 0);

error: invalid operands to binary expression ('const auto' and 'int')

It seems the 'const auto' was never resolved to the real type.

GuillaumeDua commented 3 years ago

mentioned in issue llvm/llvm-bugzilla-archive#49998

llvmbot commented 3 years ago

mentioned in issue llvm/llvm-bugzilla-archive#43556

llvmbot commented 4 years ago

Looks like this is: https://reviews.llvm.org/D65022

This fix has not been merged until now.

3a3ee7bd-941c-4a35-8f11-f0c2bc84adbe commented 4 years ago

This bug also leads to compiler crashes.

See: https://godbolt.org/z/aqhNG2

3a3ee7bd-941c-4a35-8f11-f0c2bc84adbe commented 4 years ago

It seems still no fix has landed in trunk and clang 9 release branch.

This is bad and inhibits that we currently cannot use clang 9 for the basicpp17 library now.

llvmbot commented 5 years ago

Bug llvm/llvm-bugzilla-archive#43556 has been marked as a duplicate of this bug.

llvmbot commented 5 years ago

Looks like this is: https://reviews.llvm.org/D65022