nontype12.c

来自「用于进行gcc测试」· C语言 代码 · 共 36 行

C
36
字号
// PR c++/20172// Origin: Volker Reichelt <reichelt@igpm.rwth-aachen.de>template<typename T> struct A{  template<T> int foo();                        // { dg-error "double" }  template<template<T> class> int bar();        // { dg-error "double" }  template<T> struct X;                         // { dg-error "double" }};A<char>   a1;A<double> a2;                                   // { dg-error "instantiated" }template<typename T> struct B{  template<double> int foo();                   // { dg-error "double" }  template<template<double> class> int bar();   // { dg-error "double" }  template<double> struct X;                    // { dg-error "double" }};template<void> int foo();                       // { dg-error "void" }template<template<void> class> int bar();       // { dg-error "void" }template<void> struct X;                        // { dg-error "void" }template<typename T> struct C{  template<T> int foo();                        // { dg-error "double" }};template<typename T> int baz(T) { C<T> c; }     // { dg-error "instantiated" }void foobar(){  baz(1.2);                                     // { dg-error "instantiated" }}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?