Debian Codegraph @

gcc/testsuite/g++.dg/template/nontype12.C

raw
1 // PR c++/20172
2 // Origin: Volker Reichelt <[email protected]>
3
4 template<typename T> struct A
5 {
6 template<T> int foo(); // { dg-error "double" "" { target c++17_down } }
7 template<template<T> class> int bar(); // { dg-bogus {double[^\n]*\n[^\n]*C:7:[^\n]*double} "" { xfail c++17_down } }
8 // The above xfailed dg-bogus test means that we issue two errors
9 // for the invalid 'double' NTTP, and preferably we'd issue just one.
10 template<T> struct X; // { dg-error "double" "" { target c++17_down } }
11 };
12
13 A<char> a1;
14 A<double> a2; // { dg-message "required" "" { target c++17_down } }
15
16 template<typename T> struct B
17 {
18 template<double> int foo(); // { dg-error "double" "" { target c++17_down } }
19 template<template<double> class> int bar(); // { dg-error "double" "" { target c++17_down } }
20 template<double> struct X; // { dg-error "double" "" { target c++17_down } }
21 };
22
23 template<void> int foo(); // { dg-error "void" }
24 template<template<void> class> int bar(); // { dg-error "void" }
25 template<void> struct X; // { dg-error "void" }
26
27 template<typename T> struct C
28 {
29 template<T> int foo(); // { dg-error "double" "" { target c++17_down } }
30 };
31
32 template<typename T> int baz(T) { C<T> c; return 0;} // { dg-message "required" "" { target c++17_down } }
33
34 void foobar()
35 {
36 baz(1.2); // { dg-message "required" "" { target c++17_down } }
37 }