https://bugs.llvm.org/show_bug.cgi?id=47792
Bug ID: 47792
Summary: Inconsitency between variable decltype(auto) in
variables and templates
Product: clang
Version: trunk
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P
Component: C++17
Assignee: unassignedclangb...@nondot.org
Reporter: anders.granlun...@gmail.com
CC: blitzrak...@gmail.com, erik.pilking...@gmail.com,
llvm-bugs@lists.llvm.org, richard-l...@metafoo.co.uk
Consider the following program:
#include <iostream>
#include <type_traits>
template<decltype(auto) N>
void f()
{
std::cout << std::is_same_v<decltype(N), int> << std::endl;
}
int main()
{
const int i = 0;
f<i>();
decltype(auto) N = i;
std::cout << std::is_same_v<decltype(N), const int> << std::endl;
}
When compiling it with -std=c++17 -pedantic-errors and the running it the
following is outputed:
1
1
This means that the two decltype(auto) deductions behaved differently since
they deduced different types ( N = int and N = const int ). I expect them to
behave the same way.
Note that gcc gives the expected result ( N = const int for both deductions ).
Link to compiler explorer (clang to the left, gcc to the right):
https://godbolt.org/z/Y5Yc7M
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs