mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-25 08:06:06 +00:00

This reverts commit f2583f3acf596cc545c8c0e3cb28e712f4ebf21b. There is a large body of non-conforming C-like code using format strings like this: #define PRIuS "zu" void h(size_t foo, size_t bar) { printf("foo is %"PRIuS", bar is %"PRIuS, foo, bar); } Rejecting this code would be very disruptive. We could decide to do that, but it's sufficiently disruptive that I think it requires gathering more community consensus with an RFC, and Aaron indicated [1] it's OK to revert for now so continuous testing systems can see past this issue while we decide what to do. [1] https://reviews.llvm.org/D153156#4607717
26 lines
700 B
C++
26 lines
700 B
C++
// RUN: %clang_cc1 -pedantic-errors -std=c++11 -emit-pch %s -o %t
|
|
// RUN: %clang_cc1 -pedantic-errors -std=c++11 -include-pch %t -verify %s
|
|
|
|
// RUN: %clang_cc1 -pedantic-errors -std=c++11 -emit-pch -fpch-instantiate-templates %s -o %t
|
|
// RUN: %clang_cc1 -pedantic-errors -std=c++11 -include-pch %t -verify %s
|
|
|
|
#ifndef HEADER_INCLUDED
|
|
|
|
#define HEADER_INCLUDED
|
|
|
|
using size_t = decltype(sizeof(int));
|
|
int operator"" _foo(const char *p, size_t);
|
|
|
|
template<typename T> auto f(T t) -> decltype(t + ""_foo) { return 0; }
|
|
|
|
#else
|
|
|
|
int j = ""_foo;
|
|
int k = f(0);
|
|
int *l = f(&k);
|
|
struct S {};
|
|
int m = f(S()); // expected-error {{no matching}}
|
|
// expected-note@14 {{substitution failure}}
|
|
|
|
#endif
|