Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7616053
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T02:47:49+00:00 2026-05-31T02:47:49+00:00

GCC complains about this code even though I compile with -std=c++11 flag, and my

  • 0

GCC complains about this code even though I compile with -std=c++11 flag, and my gcc version supposedly supports Unrestricted unions (>4.6).

union 
{
    struct 
    {
        float4 I,J,K,T;
    };
    struct 
    {
        float4 m_lines[4];
    };
    struct
    {
        float m16f[16];
    };
    struct 
    {
        float m44f[4][4];
    };
};

Note that float4 has a non-default constructor that takes 0 parameters.

class float4 
{   
    public:
       float4();
 ....
};

Any idea of what I could do ? The error is :

<anonymous union>::<anonymous struct>::I’ with constructor not allowed in anonymous aggregate
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T02:47:50+00:00Added an answer on May 31, 2026 at 2:47 am

    The issue here is not the fact that your class float4 has a constructor, making it a non-POD under the old C++03 definition of POD. Rather, the issue is that your union and the structs within your union are anonymous. If you simply name them, it will work:

    union u
    {
        struct s1
        {
            float4 I,J,K,T;
        };
        struct s2
        {
            float4 m_lines[4];
        };
        struct s3
        {
            float m16f[16];
        };
        struct s4
        {
            float m44f[4][4];
        };
    };
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We're stumped as to why gcc complains about this line in our app: doubleFrom->setValidator(new
The short version: I try to compile MAGMA and get complains about missing symbols:
I tried to compile my program, with Code::Blocks (gcc compiler). And I get an
I just released a skiplist container library. And the Sun compiler complains about this:
I just released a skiplist container library. And the Sun compiler complains about this:
I'm attempting to compile a file that instantiates this class. GCC gives me cryptic
I just realised that this program compiles and runs (gcc version 4.4.5 / Ubuntu):
I'm having trouble deciding whether not this code should compile or if just both
I'm tyring to compile Yenc for Python 3.2. I noticed that gcc complained about
http://developer.apple.com/mac/library/documentation/DeveloperTools/gcc-4.0.1/gcc/Thread_002dLocal.html Documents __thread yet my g++ complains that __thread is not supported on my

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.