karies added a comment.

Two comments:

- I think the part `Val.getBitWidth() == 64` likely needs rewording, although I 
don't know how
- I can show the motivation, not sure whether that qualifies as a test case:

  $ echo 'template <unsigned long long> struct S{}; S<(unsigned long long)-1> s 
= 42;' | clang++ -fsyntax-only -std=c++14 -x c++ -
  <stdin>:1:69: error: no viable conversion from 'int' to 'S<(unsigned long 
long)-1>'
  template <unsigned long long> struct S{}; S<(unsigned long long)-1> s = 42;
                                                                      ^   ~~
  <stdin>:1:38: note: candidate constructor (the implicit copy constructor) not 
viable: no known conversion from 'int' to 'const S<18446744073709551615> &' for 
1st argument
  template <unsigned long long> struct S{}; S<(unsigned long long)-1> s = 42;
                                       ^                                  ~~
  <stdin>:1:38: note: candidate constructor (the implicit move constructor) not 
viable: no known conversion from 'int' to 'S<18446744073709551615> &&' for 1st 
argument
  template <unsigned long long> struct S{}; S<(unsigned long long)-1> s = 42;
                                       ^                                  ~~
  1 error generated.

The following shows that the name clang usew for diagnostics 
(`S<18446744073709551615> &`) is actually invalid:

  $ echo 'template <unsigned long long> struct S{}; S<18446744073709551615> a;' 
| clang++ -fsyntax-only -std=c++14 -x c++ -
  <stdin>:1:45: warning: integer literal is too large to be represented in a 
signed integer type, interpreting as unsigned [-Wimplicitly-unsigned-literal]
  template <unsigned long long> struct S{}; S<18446744073709551615> a;
                                              ^
  1 warning generated.

My goal is for clang to print a valid class name, which means this should be 
spelled S<18446744073709551615ull>`.


Repository:
  rL LLVM

https://reviews.llvm.org/D34912



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to