dr49.c

来自「linux下编程用 编译软件」· C语言 代码 · 共 20 行

C
20
字号
// { dg-do compile }// Contributed by: Giovanni Bajo <giovannibajo at gcc dot gnu dot org>// DR 49: Non-constant pointers are invalid template arguments.template<int *a> struct R { /* ... */ };template<int b[5]> struct S { /* ... */ };int p;template struct R<&p>; // OKtemplate struct S<&p>; // OK due to parameter adjustmentint *ptr;template struct R<ptr>; // { dg-error "constant" }template struct S<ptr>; // { dg-error "constant" }int v[5];template struct R<v>; // OK due to implicit argument conversiontemplate struct S<v>; // OK due to both adjustment and conversion

⌨️ 快捷键说明

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