Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/131.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ gcc 4.9.2缺陷-缺少字段初始值设定项?_C++_C++11_Gcc_Gcc Warning - Fatal编程技术网

C++ gcc 4.9.2缺陷-缺少字段初始值设定项?

C++ gcc 4.9.2缺陷-缺少字段初始值设定项?,c++,c++11,gcc,gcc-warning,C++,C++11,Gcc,Gcc Warning,我在这段代码中有一个问题-可以将其1:1复制到cpp文件中,以测试其行为: #include <atomic> typedef struct { char sDateTime [20]; char sLogFileDirectory [300]; char sLogFileNameTemplate [300]; char sLogO

我在这段代码中有一个问题-可以将其1:1复制到cpp文件中,以测试其行为:

#include <atomic>

typedef struct
{
    char                sDateTime [20];
    char                sLogFileDirectory [300];
    char                sLogFileNameTemplate [300];
    char                sLogOutput [10][100];
    std::atomic<bool>   bReadyToFlush;
} LogEntries;

typedef struct
{
    LogEntries              leLogEntries [1] {};
} LogThreads;
在此行中添加
{}
初始值设定项

std::atomic<bool>   bReadyToFlush {};

g++将产生5000个警告!我认为对每个数组值重复警告是没有意义的。

更新:

第一个案例现已由GNU确认,这是一个bug,但已在gcc 5.0中修复

ICE[内部编译器错误]现在位于错误数据库中

这似乎是一只虫子。我现在正在玩一些游戏,修改后,编译器消息gcc由于内部错误而停止

根据要求更新:gcc无法编译的代码。编译器选项:
g++-std=c++11 gcc-warning-bug.cpp-Wall-Wextra-Werror-fno严格别名-fwrapv-fno主动循环优化-c
-有些选项存在,因为GNU请求它提供错误报告

#include <atomic>

class LogEntries
{
public:
    char                sDateTime [20];
    std::atomic<bool>   bReadyToFlush;
};

class LogThreads
{
public:
    static LogEntries   leLogEntries [10];
};

LogEntries LogThreads::leLogEntries [10] {};
#包括
类日志条目
{
公众:
字符sDateTime[20];
std:原子荧光粉;
};
类日志线程
{
公众:
静态日志记录法[10];
};
LogEntries LogThreads::leLogEntries[10]{};
编译器因以下输出而失败:

gcc-warning-bug.cpp:16:43: internal compiler error: in gimplify_init_constructor, at gimplify.c:4007
....
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.
gcc警告bug.cpp:16:43:内部编译器错误:在gimplify_init_构造函数中,在gimplify.c:4007
....
请提交完整的bug报告,
如果合适,使用预处理源。
请在任何错误报告中包含完整的回溯。
有关说明,请参阅。
我将准备示例代码并将其提交给开发团队。在我的项目中,成员是静态的


当您删除<代码> STD::原子< /代码>行时,它工作->代码< STD::原子< /代码>实现?< /p>如何编写C++风格代码?(<代码> TyPufFrxt{{}},< /代码>不能在任何我知道的C++教程中找到)@沃尔特:这是一个从NVIDIA中为CUDA纯C代码编写的项目。自从上周二CUDA7.0发布以来,我现在正在逐步将代码迁移到C++11标准。谢谢你的评论,但这不是重点。@Walter:我同意Al。做你建议的微不足道的更改不会改变编译器的行为。OP的结构定义毕竟是有效的C++。@ Tyyk这不是答案,只是一个注释。当然,这与这个问题没有直接关系。

#include <atomic>

class LogEntries
{
public:
    char                sDateTime [20];
    std::atomic<bool>   bReadyToFlush;
};

class LogThreads
{
public:
    static LogEntries   leLogEntries [10];
};

LogEntries LogThreads::leLogEntries [10] {};
gcc-warning-bug.cpp:16:43: internal compiler error: in gimplify_init_constructor, at gimplify.c:4007
....
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.