Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where in the Standard (C++14) does it say that the following two declarations are equivalent?

struct A{};
int A;
struct A a;
struct A::A b;

The last two declarations above are equivalent.They both declare objects of type A. Where in the Standard can I find or deduce this?

like image 350
Leon Avatar asked Apr 17 '15 17:04

Leon


People also ask

What is purchase consideration as per AS 14?

Purchase consideration means the price payable by Transferee. Company to the Transferor Company for acquiring its business. According to AS-14, ―Consideration for amalgamation means the. aggregate of the shares and other securities issued and the payment. made in the form of cash or other assets by Transferee Company ...

What are the types of amalgamation as per AS 14?

There are basically two methods of accounting for amalgamations. These include: Pooling of Interest Method and Purchase Method. This method is used in circumstances when an amalgamation fulfills the criteria for a merger as mentioned above.

What is mean by consideration for amalgamation as per AS 14?

Otherwise it is treated as amalgamation in nature of Purchase. In the amalgamation, Purchase Consideration is anything that was given to shareholders of the Selling Company. Here anything means equity shares, other securities or cash or debentures, etc. and shareholders may be of equity or preference share holders.

What does IAS 1 say?

IAS 1 Presentation of Financial Statements sets out the overall requirements for financial statements, including how they should be structured, the minimum requirements for their content and overriding concepts such as going concern, the accrual basis of accounting and the current/non-current distinction.


1 Answers

[class]/2:

A class-name is inserted into the scope in which it is declared immediately after the class-name is seen. The class-name is also inserted into the scope of the class itself; this is known as the injected-class-name.

I.e. A::A::A::A refers to A as well. In some contexts, A::A could name the constructor instead, though - [class.qual]/2 covers this, and its note even addresses your example:

In a lookup in which function names are not ignored33 and the nested-name-specifier nominates a class C

  • if the name specified after the nested-name-specifier, when looked up in C, is the injected-class-name of C (Clause 9), or
  • in a using-declaration (7.3.3) that is a member-declaration, if the name specified after the nested-name- specifier is the same as the identifier or the simple-template-id’s template-name in the last component of the nested-name-specifier,

the name is instead considered to name the constructor of class C. [ Note: For example, the constructor is not an acceptable lookup result in an elaborated-type-specifier so the constructor would not be used in place of the injected-class-name. — end note ]


33) Lookups in which function names are ignored include names appearing in a nested-name-specifier, an elaborated-type- specifier, or a base-specifier.

So in a statement such as

A::A a;

Function names are not ignored when looking up A::A, and thus the code is ill-formed as A::A refers to the constructor. However, in

struct B : A::A {};
struct A::A a;

Everything is fine as function names are ignored in base-specifiers and elaborated-type-specifiers.

like image 122
Columbo Avatar answered Sep 30 '22 04:09

Columbo